This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List question

 
John Olivas
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is why do I throw an exception every time I try to add data to my List?

method below, thanks!

 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to show the exact expression information that is returned and indicate which line is throwing it to get better help. So for now I can only guess that you're getting a NullPointerException as you never initialize the result List<String>.

For instance, I would change this:


to this:


ps: I added code tags to your post to help make it readable. The forum FAQ's will show you how to do this yourself: UseCodeTags

ps2: Please let me be the first to welcome you to JavaRanch!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(And make sure you close the connection, and don't over-comment.)
 
John Olivas
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both. I will add the code tags and remove the excess comments before posting.

And yes you were correct, initializing the List did the trick.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic