You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/03/15 09:22:20 UTC
svn commit: r518510 -
/incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
Author: gnodet
Date: Thu Mar 15 01:22:20 2007
New Revision: 518510
URL: http://svn.apache.org/viewvc?view=rev&rev=518510
Log:
SM-877: Bottleneck in SoapReader.readSoapUsingDom()
Modified:
incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
Modified: incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java?view=diff&rev=518510&r1=518509&r2=518510
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java Thu Mar 15 01:22:20 2007
@@ -28,7 +28,7 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
@@ -94,11 +94,14 @@
private SoapMessage readSoapUsingDom(InputStream is) throws Exception {
SoapMessage message = new SoapMessage();
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- Document doc = factory.newDocumentBuilder().parse(is);
+ DocumentBuilder builder = DOMUtil.getBuilder();
+ try {
+ Document doc = builder.parse(is);
message.setDocument(doc);
- Element env = doc.getDocumentElement();
+ } finally {
+ DOMUtil.releaseBuilder(builder);
+ }
+ Element env = message.getDocument().getDocumentElement();
QName envName = DOMUtil.getQName(env);
if (!envName.getLocalPart().equals(SoapMarshaler.ENVELOPE)) {
throw new SoapFault(SoapFault.SENDER, "Unrecognized element: "