You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2007/04/10 19:16:05 UTC

svn commit: r527205 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java

Author: scheu
Date: Tue Apr 10 10:16:04 2007
New Revision: 527205

URL: http://svn.apache.org/viewvc?view=rev&rev=527205
Log:
AXIS2-2495
Contributor:Rich Scheuerle
Upgrade XMLSpineImpl to close the parser.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java?view=diff&rev=527205&r1=527204&r2=527205
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java Tue Apr 10 10:16:04 2007
@@ -21,6 +21,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.llom.OMElementImpl;
 import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
@@ -44,11 +45,13 @@
 import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.utility.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.jws.soap.SOAPBinding.Style;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -499,9 +502,31 @@
 
             // We want to set the om element and its parents to complete to 
             // shutdown the parsing.  
-            // TODO It would also be nice to close the input XMLStreamReader connected
-            // to the builder.
             if (setComplete) {
+                
+                // Get the root of the document
+                OMElementImpl root = (OMElementImpl) om;
+                while(root.getParent() instanceof OMElementImpl) {
+                    root = (OMElementImpl) root.getParent();
+                }
+                
+                try {   
+                    if (!root.isComplete() && root.getBuilder() != null && !root.getBuilder().isCompleted()) {
+                        // Forward the parser to the end so it will close
+                        while (root.getBuilder().next() != XMLStreamConstants.END_DOCUMENT) {
+                            //do nothing
+                        }                    
+                    }
+                } catch (Exception e) {
+                    // Log and continue
+                    if (log.isDebugEnabled()) {
+                        log.debug("Builder next error:" + e.getMessage());
+                        log.debug(JavaUtils.stackToString(e));
+                    }
+                    
+                }
+                
+
                 OMContainer o = om;
                 while (o != null && o instanceof OMContainerEx) {
                     ((OMContainerEx)o).setComplete(true);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org