Menu

NullPointerException in DOMDriver

Help
Anonymous
2001-11-13
2012-10-08
  • Anonymous

    Anonymous - 2001-11-13

    I am using Saxon 6.4.4 with Xerces 1.4.3. I use the DocumentBuilderFactory to create a Document object. Problems arise when Document.createTextNode(null) is called then the Document is passed to the Transformer via DOMSource. Specifically, a NullPointerException is thrown by DOMDriver.walkNode (when it tries to convert the String.toCharArray()).

    I'm not sure if the footprint for the Document.createTextNode method should specify "throws NullPointerException" which would imply that Xerces should throw that exception when it encounters a null argument. However, it doesn't seem to be harmful for DOMDriver to regard a null in a text node as a zero-length string.

    In any case, it seems that if it is permitted to add something to a Document, you should be able to get that something out.

    I have a simple class that demonstrates the problem if you want me to send it somewhere.

    BTW - The performance of Saxon for XSL transformations is incredible. Thanks for writing it!

    Please disregard the previously submitted support request on this subject.

     
    • Michael Kay

      Michael Kay - 2001-11-13

      I don't think Xerces should be allowing this. I'm not even sure if a DOM Text node should be allowed to contain a zero-length string. But as usual, the DOM spec seems to be thoroughly woolly on the subject, so it seems defensive programming is needed once again.

      Mike Kay

       
    • Michael Kay

      Michael Kay - 2001-11-13

      I don't think Xerces should be allowing this. I'm not even sure if a DOM Text node should be allowed to contain a zero-length string. But as usual, the DOM spec seems to be thoroughly woolly on the subject, so it seems defensive programming is needed once again.

      Mike Kay

       
    • Anonymous

      Anonymous - 2002-02-05

      Although not really a bug will this be classified as a bug in order to get the fix into a future release?

       
    • Anonymous

      Anonymous - 2002-02-05

      I apologize...the fix is already in 6.5 - Thanks