jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java
changeset 43852 93a527059d8a
parent 33547 e4c76ac38b12
child 45678 65fdff10664d
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Fri Feb 10 00:39:51 2017 -0800
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java	Thu Feb 16 13:14:39 2017 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
 import org.w3c.dom.*;
 import org.w3c.dom.Node;
 
@@ -60,6 +61,10 @@
         super(ownerDoc, bodyName);
     }
 
+    public BodyImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+        super(ownerDoc, domElement);
+    }
+
     protected abstract NameImpl getFaultName(String name);
     protected abstract boolean isFault(SOAPElement child);
     protected abstract SOAPBodyElement createBodyElement(Name name);
@@ -155,7 +160,7 @@
         if (hasFault()) {
             if (fault == null) {
                 //initialize fault member
-                fault = (SOAPFault) getFirstChildElement();
+                fault = (SOAPFault) getSoapDocument().find(getFirstChildElement());
             }
             return fault;
         }
@@ -259,11 +264,12 @@
     }
 
     protected SOAPElement convertToSoapElement(Element element) {
-        if ((element instanceof SOAPBodyElement) &&
+        final Node soapNode = getSoapDocument().findIfPresent(element);
+        if ((soapNode instanceof SOAPBodyElement) &&
             //this check is required because ElementImpl currently
             // implements SOAPBodyElement
-            !(element.getClass().equals(ElementImpl.class))) {
-            return (SOAPElement) element;
+            !(soapNode.getClass().equals(ElementImpl.class))) {
+            return (SOAPElement) soapNode;
         } else {
             return replaceElementWithSOAPElement(
                 element,
@@ -314,7 +320,7 @@
 
         Document document = null;
         try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
             factory.setNamespaceAware(true);
             DocumentBuilder builder = factory.newDocumentBuilder();
             document = builder.newDocument();
@@ -440,7 +446,7 @@
             //not lazy -Just get first child element and return its attribute
             Element elem = getFirstChildElement();
             if (elem != null) {
-                return elem.getAttribute(localName);
+                return elem.getAttribute(getLocalName());
             }
         }
         return null;