• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

NullPointer in 1.5 NOT in 1.6

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 22510
122
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
It would help to print the stacktrace here.
 
Nickolas Case
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 225
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .....
reply
    Bookmark Topic Watch Topic
  • New Topic