You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2012/12/26 02:13:22 UTC

svn commit: r1425803 - /servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java

Author: ffang
Date: Wed Dec 26 01:13:21 2012
New Revision: 1425803

URL: http://svn.apache.org/viewvc?rev=1425803&view=rev
Log:
[SMX4-1319]use StreamSource but not DOMSource for cxf-nmr-transport

Modified:
    servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java

Modified: servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java?rev=1425803&r1=1425802&r2=1425803&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java (original)
+++ servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestinationOutputStream.java Wed Dec 26 01:13:21 2012
@@ -30,7 +30,7 @@ import java.util.logging.Logger;
 import javax.security.auth.Subject;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Document;
 
@@ -78,12 +78,8 @@ public class NMRDestinationOutputStream 
                 return;
             } else {
                 InputStream bais = getInputStream();
-                LOG.finest(new org.apache.cxf.common.i18n.Message("BUILDING.DOCUMENT", LOG).toString());
-                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
-                docBuilderFactory.setNamespaceAware(true);
-                DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
-                Document doc = builder.parse(bais);
-            
+                StreamSource ss = new StreamSource(bais);
+                           
                 Exchange xchng = inMessage.get(Exchange.class);
                 LOG.fine(new org.apache.cxf.common.i18n.Message("CREATE.NORMALIZED.MESSAGE", LOG).toString());
                 if (inMessage.getExchange().getOutFaultMessage() != null) {
@@ -92,7 +88,7 @@ public class NMRDestinationOutputStream 
                         xchng.setError(f);
                     }
                     // As the fault is already marshalled by the fault handler
-                    xchng.getFault().setBody(new DOMSource(doc));
+                    xchng.getFault().setBody(ss);
                 } else {
                     //copy attachments
                     if (outMessage != null && outMessage.getAttachments() != null) {
@@ -115,7 +111,7 @@ public class NMRDestinationOutputStream 
 
                     //copy securitySubject
                     xchng.getOut().setSecuritySubject((Subject) outMessage.get(NMRTransportFactory.NMR_SECURITY_SUBJECT));
-                    xchng.getOut().setBody(new DOMSource(doc));
+                    xchng.getOut().setBody(ss);
                 }
                 LOG.fine(new org.apache.cxf.common.i18n.Message("POST.DISPATCH", LOG).toString());
                 channel.send(xchng);