mrglavas    2004/10/22 14:11:12

  Modified:    java/src/org/apache/xml/serialize DOMSerializerImpl.java
  Log:
  Fixing JIRA Bug #1023:

  http://nagoya.apache.org/jira/browse/XERCESJ-1023

  

  The previous fix masked 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.
  
  Revision  Changes    Path
  1.30      +23 -20    
xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java
  
  Index: DOMSerializerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DOMSerializerImpl.java    6 Sep 2004 22:25:27 -0000       1.29
  +++ DOMSerializerImpl.java    22 Oct 2004 21:11:11 -0000      1.30
  @@ -1008,27 +1008,30 @@
                   //no way to test the version...
                   //ignore the exception
               }
  -            while (node != null) {
  -              verify(node, verifyNames, false);
  -              // Move down to first child
  -              next = node.getFirstChild();
  -              // No child nodes, so walk tree
  -              while (next == null) {
  -                // Move to sibling if possible.
  -                next = node.getNextSibling();
  -                if (next == null){
  -                    node = node.getParentNode();
  -                    if (node == null || root == node){
  -                        next = null;
  -                        break;                   
  +            if (node.getFirstChild() != null) {
  +                while (node != null) {
  +                    verify(node, verifyNames, false);
  +                    // Move down to first child
  +                    next = node.getFirstChild();
  +                    // No child nodes, so walk tree
  +                    while (next == null) {
  +                      // Move to sibling if possible.
  +                      next = node.getNextSibling();
  +                      if (next == null) {
  +                          node = node.getParentNode();
  +                          if (root == node){
  +                              next = null;
  +                              break;                   
  +                          }
  +                          next = node.getNextSibling();
  +                      }
                       }
  -                    next = node.getNextSibling();
  +                    node = next;
                   }
  -              }
  -              node = next;
  -          }
  - 
  -
  +            }
  +            else {
  +                verify(node, verifyNames, false);
  +            }
           }
       }
       
  
  
  

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

Reply via email to