• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointer in 1.5 NOT in 1.6

 
Nickolas Case
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Spring enabled stand-alone app that creates XML documents and transforms them into KML. When I run the application using JRE 1.5, I receive a NullPointerException. If I use JRE 1.6 the program runs like a charm. Even is I use a JRE of 1.6 with a target of 1.5 it runs. Only when JRE is 1.5 does the program fail. A previous version runs on 1.5 OR 1.6 but isn't as Spring intensive.

The NullPointer comes when the XML is normalized or transformed (Taking normalize out just causes the transformer to throw the NullPointer).

Has anyone else had or heard of this type of problem?

I have debugged both versions, all attributes are identical up to the point of calling normalize() on the xml only one throws a NullPointer and one does not.

 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would help to print the stacktrace here.
 
Nickolas Case
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, make sure you're using the very last patch release for JDK 1.5, in case it's a bug that was eventually fixed. Otherwise you might try using another DOM implementation besides the built-in one.
 
Nickolas Case
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe using a different DOM would matter.

If I ANT build using JRE 1.6 with a target of 1.5 I get no errors. It is only on a box with 1.5 that I get the error.

Was just curious if there is a simple code workaround as I can't just upgrade the JRE in this case.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nickolas Case wrote:I don't believe using a different DOM would matter.


Are you sure? Cause it sure looks like a bug in that "normalize()" method. A different DOM implementation (or a different JDK, which includes a different DOM implementation) would fix that.
 
Nickolas Case
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried normalizeDocument() instead of normalize(). Nothing. I even removed normalize() from the code altogether. But my transformer threw the nullPointer instead. There is no normalize() in my transform.
 
Carey Evans
Ranch Hand
Posts: 225
Debian Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could there be a null making it into an attribute value or text node somewhere in the DOM? There may be an extra null check in Java 6's version of Xerces that isn't in Java 5.

If you can't find the null, you could try using downloading and using Xerces 2.9.1, and possibly the latest version of Xalan or Saxon, to see if they have the same logic as Java 6.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks like a problem more with the XML APIs so moving it to the XML and Related Technologies forum .....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic