Permalink
Browse files

[SMX4-1319]use StreamSource but not DOMSource for cxf-nmr-transport

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/features/trunk@1425803 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 156ac24 commit e5ea7cef516f48b5f983aa55e95cd8cdb93cffbd @ffang ffang committed Dec 26, 2012
@@ -30,7 +30,7 @@
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 @@ private void commitOutputMessage() throws IOException {
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 @@ private void commitOutputMessage() throws IOException {
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 @@ private void commitOutputMessage() throws IOException {
//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);

0 comments on commit e5ea7ce

Please sign in to comment.