sjsxp
  1. sjsxp
  2. SJSXP-32

NullPointerException in XMLDOMWriterImpl.writeCharacters()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      32

      Description

      If you try to write some characters outside of an element you get a null
      pointer exception. I'm trying to write a newline character into the DOM so
      that it prints nicely when serialized. Here's my code:

      _xmlStreamWriter.writeStartDocument();
      _xmlStreamWriter.writeCharacters("\n");

      Here's the error:
      java.lang.NullPointerException
      at com.sun.xml.stream.writers.XMLDOMWriterImpl.writeCharacters
      (XMLDOMWriterImpl.java:311)

        Activity

        Hide
        Joe Wang added a comment -

        The above code would result in an attempt to append a text node to the Document
        object. Refer to <a
        href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Embedded-DOM">DOM
        spec</a>, the action is not permitted.

        However, there is a bug in the impl class that causes it to throw a null pointer
        exception instead of the DOMExectpion: HIERARCHY_REQUEST_ERR: An attempt was
        made to insert a node where it is not permitted. This has been fixed. The above
        code would now throw HIERARCHY_REQUEST_ERR exception.

        Show
        Joe Wang added a comment - The above code would result in an attempt to append a text node to the Document object. Refer to <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Embedded-DOM">DOM spec</a>, the action is not permitted. However, there is a bug in the impl class that causes it to throw a null pointer exception instead of the DOMExectpion: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. This has been fixed. The above code would now throw HIERARCHY_REQUEST_ERR exception.

          People

          • Assignee:
            Joe Wang
            Reporter:
            howard_ungar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: