• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need Help as to NullPointer Exception Possibilities

 
Ranch Hand
Posts: 2211
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2211
    2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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.
     
    Sheriff
    Posts: 17644
    300
    Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Run away! Run away! Here, take this tiny ad with you:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic