Message:

   The following issue has been resolved as FIXED.

   Resolver: Michael Glavassevich
       Date: Fri, 22 Oct 2004 2:17 PM

The fix for XERCESJ-969 (similar to the one suggested here) masks the real bug here. 
If the root node being serialized has no children we were walking up the tree instead 
of stopping immediately. The old fix just prevented the NullPointerException but 
didn't stop well-formedness checking of the root node's following siblings and 
following siblings of its ancestors. This should be fixed in CVS now.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESJ-1023

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESJ-1023
    Summary: NullPointerException in DOMSerializerImpl.writeToString(Node)
       Type: Bug

     Status: Resolved
   Priority: Major
 Resolution: FIXED

    Project: Xerces2-J
 Components: 
             DOM
   Versions:
             2.6.2

   Assignee: Michael Glavassevich
   Reporter: Juergen Birkle

    Created: Fri, 22 Oct 2004 10:16 AM
    Updated: Fri, 22 Oct 2004 2:17 PM
Environment: Linux, JDK 1.3.1, Xalan 2.6.0, Xerces 2.6.2

Description:
The following simple example result in a NullPointerException:
-----
String testdata = "<x />";
InputSource in = new InputSource(new StringReader(testdata));
DOMParser parser = new DOMParser();
parser.parse(in);
Document doc = parser.getDocument();
Node root = doc.getDocumentElement();
DOMSerializerImpl dsi = new DOMSerializerImpl();
String result = dsi.writeToString(root);
-----

The source of the NullPointerException is in 
DOMSerializerImpl.prepareForSerialization(), line 1030.

When the call to 'node.getParentNode()' returns 'null' this the code 'next = 
node.getNextSibling();' must crash.

I have fixed this problem by replacing line 1026-1030 with the following code:
-----
if(node == null) {
   next = null;
   break;                   
}
if (root == node){
   next = null;
   break;                   
}
next = node.getNextSibling();
-----

But I don't know, if this patch is neutral to the behaviour of the method.

Best regards,
Juergen Birkle


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to