• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Help as to NullPointer Exception Possibilities  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1780
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following line of code is throwing the NullPointer Exception.

I have verified that the client code requesting the Servlet that calls the class has the badgenumber variable.

error:
java.lang.NullPointerException
[10/14/16 0:12:55:357 CDT] 00000088 SystemErr     R at com.FAIWebApp.logonconnections.LogOn.<init>(LogOn.java:60)
[10/14/16 0:12:55:357 CDT] 00000088 SystemErr     R at com.FAIWebApp.logonconnections.LogonControllerServlet.doPost(LogonControllerServlet.java:172)

js:


global:


servlet:



logon class:

 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:. . . .
So it is that line that causes the Exception to be thrown? And it is a java.lang.NullPointerException so it probably isn't thrown by the the JS code. In that line, there are several things which might be null:-
  • request
  • the return value from getParameter
  • QMS_ALLOWED_CHARS. Since you have showed where that is created, you can be >99% sure this isn't the culprit.
  • Or is the problem on this line?Is there any chance that any of request, m or dft is null? In which case does that constructor ever throw such an Exception?

    I presume you know how to identify nulls with printf and the %b tag?
     
    Steve Dyke
    Ranch Hand
    Posts: 1780
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Campbell Ritchie wrote:
    Steve Dyke wrote:. . . .
    So it is that line that causes the Exception to be thrown? And it is a java.lang.NullPointerException so it probably isn't thrown by the the JS code. In that line, there are several things which might be null:-
  • request
  • the return value from getParameter
  • QMS_ALLOWED_CHARS. Since you have showed where that is created, you can be >99% sure this isn't the culprit.
  • Or is the problem on this line?Is there any chance that any of request, m or dft is null? In which case does that constructor ever throw such an Exception?

    I presume you know how to identify nulls with printf and the %b tag?


    First thanks for your time and help.

    I do not see how, if the exception is being generated from a client request that the request could be null.

    And no, I am not familiar with the 'how to identify nulls with printf and the %b tag', sorry.
     
    Junilu Lacar
    Sheriff
    Posts: 11477
    180
    Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Steve Dyke wrote:...
    And no, I am not familiar with the 'how to identify nulls with printf and the %b tag', sorry.

    Well, that's the code to do it. If you care to learn more, here's the documentation that explains how it works: https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!