能否请您告诉我这段代码为什么给出NullPointerException
?
PreparedStatement ps = con.prepareStatement("SELECT signupDate FROM users WHERE username=?");
ps.setString(1,username);
ResultSet rs = ps.executeQuery();
Calendar signUpMonth = Calendar.getInstance();
if(rs.next())
signUpMonth.setTime(rs.getTimestamp(1));
`
java.lang.NullPointerException
at java.base/java.util.Calendar.setTime(Calendar.java:1800)
at com.nane.validation.changePass(validation.java:80)
at com.nane.loginServlet.doPost(loginServlet.java:25)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
`