| Author |
NullPointerException creating Liist from XML
|
John Bates
Greenhorn
Joined: May 31, 2012
Posts: 9
|
|
Hi, i am having trouble when creating a List of object Items from the entries in the XML file. i am getting errors output
----------MY CODE-----------------
// <-- -- if i remove this line its writing the xml file with out the object items of xml.. but if i include this line my output is getting errors
-------------------------OUT_PUT-------------------------------------
Exception in thread "main" java.lang.NullPointerException
at javaapplication5.NewMain.main(NewMain.java:30)
Java Result: 1
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
Something in that line is null. You need to find out what. I would put newSegments high on the list of suspects.
Why are you using small letters and names like fg for the names of types? Why are you casting the returned value in the second line?
And welcome to the Ranch
|
 |
John Bates
Greenhorn
Joined: May 31, 2012
Posts: 9
|
|
Thanks Campbell Ritchie,
I found out the reason for this, as you suggested line is null. and here it was returning class, and i can never cast a class to List in any way.
Thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
Well done
|
 |
 |
|
|
subject: NullPointerException creating Liist from XML
|
|
|