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();
}