DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28022>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28022 NullPointerException in normalizeDocument when normalizing childless Entity Reference Summary: NullPointerException in normalizeDocument when normalizing childless Entity Reference Product: Xerces2-J Version: 2.6.2 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] >From Neil Delima: Only entities that were referenced in the document contain their replacement text as child nodes. So if an entity reference node that was not referenced in the parsed document, was created and appended to the DOM tree, its child node would be null. Problem in DOMNormalizer: expandEntityRef (parent, node); parent.removeChild(node); Node next = (prevSibling != null)?prevSibling.getNextSibling ():parent.getFirstChild(); // The list of children #text -> &ent; // and entity has a first child as a text // we should not advance if (prevSibling !=null && next!=null && prevSibling.getNodeType() == Node.TEXT_NODE && next.getNodeType() == Node.TEXT_NODE) { return prevSibling; // Don't advance } If a new entity reference with no children is created that does not correspond to an existing Entity node, next will always be null and a NPE gets thrown. This happens in the current case since in Xerces, children of entity nodes are null unless referenced in the document being parsed. So the next!=null check is needed. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
