-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b14
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2181808 | 6u18 | Joe Wang | P4 | Resolved | Fixed | b02 |
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)------- Additional comments from joehw Tue Mar 6 01:42:21 +0000 2007 -------
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.
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)------- Additional comments from joehw Tue Mar 6 01:42:21 +0000 2007 -------
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.
- backported by
-
JDK-2181808 sjsxp issue 32: NullPointerException in XMLDOMWriterImpl.writeCharacters()
-
- Resolved
-