• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

IO NullPointerException

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't seem to nail down why I'm getting this null pointer exception. I've exhausted all of my brain cells attempting to get it going. Any help would be greatly appreciated!






Here is where the SKUList is



 
Ranch Hand
Posts: 344
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A stacktrace would be useful here...
 
William Kohus
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Koen Aerts wrote:A stacktrace would be useful here...




Test save =false
java.lang.NullPointerException
at SKUDictionaryPackage.SKUDictionaryR2.main(SKUDictionaryR2.java:71)

That is what I get from it.
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And which line is that in the above code? Because its line 71 is part of a comment.
 
William Kohus
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:And which line is that in the above code? Because its line 71 is part of a comment.



I'm sorry in the SKUDictionaryR2 it's line 57. ----SKUList.add(foo5); ---- That is the code it doesn't like.

I can print the SKUList SKUDictionary.printSKUList(b); and it prints out what I've added, but when I have "SKUList.add(foo5); " In my code it gives the Null pointer.


Thanks so much!
 
Sheriff
Posts: 28365
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would mean that SKUList is null.

I find it peculiar that SKUList is declared as static, but only initialized when the SKUDictionary constructor is run. That would suggest you haven't created any SKUDictionary objects yet.
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic