Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null pointer exception on using hashtable get()

 
Bravi kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am facing the null pointer exception since many days.

Could anybody please help me how to fix the above null pointer exception ?

I am copying the error trace from eclipse console window.

Caused by: java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:334)
at ....tools.hmi.window.OdWinTreeChooser.setHierarchyToObject(OdWinTreeChooser.java:497)



Thanks for helping.

Regards,
Kumar.


 
Tony Docherty
Bartender
Posts: 2958
59
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why this is posted in Performance it should probably be in the beginners section. How does one get it moved?

You are probably getting an NPE because you are passing a null value to the get method. Hashtable does not allow null keys.
BTW why are you using Hashtable, most people use HashMap instead these days.
 
Rajdeep Biswas
Ranch Hand
Posts: 221
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously, you have to debug and find out where exactly that get method is getting null from!
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bravi,

You need to post some code here to get valuable input from others..
We cannot just see a random error and tell where it went wrong without even concerning about where it came from??
See PostRealCode <- click and TellTheDetails <- click
And before you post any code, see UseCodeTags <- click
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using Hashtable?

You realise Hashtable does not allow null values for keys or values, and will probably throw that Exception if you try to use pass a null parameter to any of its methods. You can verify that by reading the documentation for Hashtable and its get method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic