• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
Marshal
Posts: 22458
121
Eclipse IDE Spring VI Editor 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: 26791
82
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic