[jbossws-commits] JBossWS SVN: r13946 - stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Sat Mar 26 23:17:28 EDT 2011


Author: jim.ma
Date: 2011-03-26 23:17:27 -0400 (Sat, 26 Mar 2011)
New Revision: 13946

Modified:
   stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
Log:
[JBWS-3251]:Check the owner document in addChildElement(SOAPElement child)

Modified: stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java	2011-03-25 16:17:45 UTC (rev 13945)
+++ stack/native/branches/jbossws-native-3.4.0.SP1/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java	2011-03-27 03:17:27 UTC (rev 13946)
@@ -274,8 +274,17 @@
     */
    public SOAPElement addChildElement(SOAPElement child) throws SOAPException
    {
-      SOAPElementImpl soapElement = (SOAPElementImpl)child;
-      soapElement = (SOAPElementImpl)appendChild(soapElement);
+      SOAPElementImpl soapElement = (SOAPElementImpl) child;
+
+      if (soapElement.domNode.getOwnerDocument() != element.getOwnerDocument())
+      {
+         Document oldDoc = DOMUtils.peekOwnerDocument();
+         DOMUtils.setOwnerDocument(element.getOwnerDocument());
+         soapElement = (SOAPElementImpl) SOAPFactoryImpl.newInstance().createElement((Element) (soapElement.domNode));
+         DOMUtils.setOwnerDocument(oldDoc);
+
+      }
+      soapElement = (SOAPElementImpl) appendChild(soapElement);
       return soapElement.completeNamespaceDeclaration();
    }
 



More information about the jbossws-commits mailing list