java.lang.NullPointerException 该怎么解决
HTTP Status 500 - type Exception report
message
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
cc.openhome.model.UserService.isInvalidUsername(UserService.java:27)
cc.openhome.controller.Register.doPost(Register.java:46)
javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
cc.openhome.web.EscapeFilter.doFilter(EscapeFilter.java:23)
cc.openhome.web.EncodingFilter.doFilter(EncodingFilter.java:34)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.12 logs.
Apache Tomcat/8.0.12
26: public boolean isInvalidUsername(String username) {
27: for (String file : new File(USERS).list()) {
28: if (file.equals(username)) {
29: return true;
30: }
31: }
32: return false;
33: }
从上面的错误信息看是这段代码有错,我就debug了一下,显示的是Source not found.,但是不知道该怎么解决,求大神赐教!