• 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

Null pointer exception on using hashtable get()

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 233
1
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously, you have to debug and find out where exactly that get method is getting null from!
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic