You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by na...@apache.org on 2008/03/28 07:30:43 UTC

svn commit: r642097 - /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java

Author: nandana
Date: Thu Mar 27 23:30:41 2008
New Revision: 642097

URL: http://svn.apache.org/viewvc?rev=642097&view=rev
Log:
Fixed an issue where the previous child is not set correctly

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=642097&r1=642096&r2=642097&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Thu Mar 27 23:30:41 2008
@@ -19,6 +19,7 @@
 package org.apache.axiom.om.impl.dom;
 
 import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocType;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -359,7 +360,11 @@
                                            "HIERARCHY_REQUEST_ERR", null));
         }
 
-        if (newDomChild != null && !this.ownerNode.equals(newDomChild.ownerNode)) {
+        if (newDomChild != null &&
+                //This is the case where this is an Element in the document
+                (this.ownerNode != null && !this.ownerNode.equals(newDomChild.ownerNode)) ||
+                //This is the case where this is the Document itself
+                (this.ownerNode == null && !this.equals(newDomChild.ownerNode))) {
             throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
                                    DOMMessageFormatter.formatMessage(
                                            DOMMessageFormatter.DOM_DOMAIN,
@@ -468,6 +473,7 @@
                 } else if (this.lastChild == tempNode) {
                     // not the first child, but the last child
                     ChildNode prevSib = tempNode.previousSibling;
+                    this.lastChild = prevSib;
                     prevSib.nextSibling = null;
                     tempNode.parentNode = null;
                     tempNode.previousSibling = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org