You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/05/23 06:17:28 UTC
DO NOT REPLY [Bug 20172] New: -
NPE when normalizing documents
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20172>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20172
NPE when normalizing documents
Summary: NPE when normalizing documents
Product: Xerces2-J
Version: 2.4.0
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: DOM
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: adrian@ephox.com
Using the DOM3 API to normalize a document, a NullPointerException is thrown in
the case that schema validation is being used and there is an Element with only
one child which is not a text node.
This can be seen with the DOM3 sample (ie: dom/DOM3.java) by parsing an XML
file like (full test case will be attached):
<?xml version="1.0"?>
<poem>
<stanza><line/></stanza>
</poem>
When Xerces gets to the stanza element it throws a NullPointerException like:
java.lang.NullPointerException
at org.apache.xerces.dom.DOMNormalizer.endElement
(DOMNormalizer.java:1487)
at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement
(XMLSchemaValidator.java:790)
at org.apache.xerces.dom.DOMNormalizer.normalizeNode
(DOMNormalizer.java:378)
at org.apache.xerces.dom.DOMNormalizer.normalizeNode
(DOMNormalizer.java:355)
at org.apache.xerces.dom.DOMNormalizer.normalizeDocument
(DOMNormalizer.java:238)
at org.apache.xerces.dom.CoreDocumentImpl.normalizeDocument
(CoreDocumentImpl.java:989)
at com.ephox.editlive.java2.editor.xml.XMLFilter.validateXML
(XMLFilter.java:1036)
at com.ephox.editlive.java2.editor.xml.ui.XMLPane.<init>
(XMLPane.java:106)
at com.ephox.editlive.java2.editor.Editor.<init>(Editor.java:55)
at com.ephox.editlive.java2.TestHarness.jbInit(TestHarness.java:191)
at com.ephox.editlive.java2.TestHarness.<init>(TestHarness.java:98)
at com.ephox.editlive.java2.TestHarness.main(TestHarness.java:346)
(Full output of the DOM3 sample will be attached)
Essentially, ParentNode.getTextContent() is returning null but
DOMNormalizer.endElement isn't expecting a null. The method
ParentNode.hasTextContent(Node) looks particularly suspicious since it returns
false for all the node types that can have text content and true for Element
nodes for which getNodeValue() must always return null.
This occurs with the latest version from CVS as well as the 2.4.0 release with
both JDK 1.4.1 and 1.3.1.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org