Author: mrglavas
Date: Wed Jun  2 15:38:55 2010
New Revision: 950601

URL: http://svn.apache.org/viewvc?rev=950601&view=rev
Log:
Fixing JIRA Issue #1450: http://issues.apache.org/jira/browse/XERCESJ-1450. 
Whenever we adopt a node from a deferred DOM we must ensure that the node and 
the entire tree beneath has been fully materialized before transferring it to 
its new owner document.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java?rev=950601&r1=950600&r2=950601&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java Wed Jun  
2 15:38:55 2010
@@ -1772,13 +1772,13 @@ extends ParentNode implements Document  
         // Return null if the source is null
         
         if (source == null) {
-               return null;
+            return null;
         } 
         else if (source != null && source.getOwnerDocument() != null) {
 
             DOMImplementation thisImpl = this.getImplementation();
             DOMImplementation otherImpl = 
source.getOwnerDocument().getImplementation();
-            
+
             // when the source node comes from a different implementation.
             if (thisImpl != otherImpl) {
                 // Adopting from a deferred DOM to a non-deferred DOM
@@ -1795,7 +1795,12 @@ extends ParentNode implements Document  
                     // Adopting between two dissimilar DOMs is not allowed
                     return null;  
                 }
-               }
+            }
+            // Adopting from a deferred DOM into another deferred DOM
+            else if (otherImpl instanceof 
org.apache.xerces.dom.DeferredDOMImplementationImpl) {
+                // traverse the DOM and expand deferred nodes and then allow 
adoption
+                undeferChildren (node);
+            }
         }
         
         switch (node.getNodeType()) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to