Message:

   The following issue has been re-assigned.

   Assignee: Michael Glavassevich (mailto:[EMAIL PROTECTED])
---------------------------------------------------------------------
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: Open
   Priority: Major

    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:15 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