You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2006/05/18 03:13:35 UTC

svn commit: r407423 - in /geronimo/branches/1.1/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java

Author: jsisson
Date: Wed May 17 18:13:35 2006
New Revision: 407423

URL: http://svn.apache.org/viewvc?rev=407423&view=rev
Log:
GERONIMO-2033 [axis] ensure input streams are closed in finally blocks

Modified:
    geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
    geronimo/branches/1.1/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java

Modified: geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java?rev=407423&r1=407422&r2=407423&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java (original)
+++ geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java Wed May 17 18:13:35 2006
@@ -31,7 +31,6 @@
 import java.util.zip.ZipEntry;
 import javax.wsdl.Definition;
 import javax.wsdl.Import;
-import javax.wsdl.Port;
 import javax.wsdl.Service;
 import javax.wsdl.Types;
 import javax.wsdl.WSDLException;
@@ -39,7 +38,6 @@
 import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLLocator;
 import javax.wsdl.xml.WSDLReader;
@@ -51,13 +49,11 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.axis.server.AxisWebServiceContainer;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.geronimo.xbeans.wsdl.DefinitionsDocument;
 import org.apache.geronimo.xbeans.wsdl.TDefinitions;
 import org.apache.geronimo.xbeans.wsdl.TPort;
 import org.apache.geronimo.xbeans.wsdl.TService;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.xmlbeans.SchemaField;
 import org.apache.xmlbeans.SchemaGlobalElement;
 import org.apache.xmlbeans.SchemaParticle;
@@ -81,7 +77,7 @@
 public class SchemaInfoBuilder {
     private static final Log log = LogFactory.getLog(SchemaInfoBuilder.class);
     private static final SchemaTypeSystem basicTypeSystem;
-    private static final String[] errorNames = {"Error", "Warning", "Info"};
+//  private static final String[] errorNames = {"Error", "Warning", "Info"};
     private static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
     private static final QName ADDRESS_QNAME = new QName(SOAP_NS, "address");
     private static final QName LOCATION_QNAME = new QName("", "location");
@@ -107,6 +103,12 @@
             throw new RuntimeException("Could not compile schema type system", e);
         } catch (IOException e) {
             throw new RuntimeException("Could not compile schema type system", e);
+        } finally {
+            try {
+                is.close();
+            } catch (IOException ignore) {
+                // ignore
+            }
         }
     }
 

Modified: geronimo/branches/1.1/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java?rev=407423&r1=407422&r2=407423&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java (original)
+++ geronimo/branches/1.1/modules/axis/src/test/org/apache/geronimo/axis/AxisWebServiceContainerTest.java Wed May 17 18:13:35 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.geronimo.axis;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.util.Collections;
@@ -94,26 +95,36 @@
         URI location = new URI(serviceDesc.getEndpointURL());
         Map wsdlMap = new HashMap();
 
-        AxisWebServiceContainer continaer =
+        AxisWebServiceContainer container =
             new AxisWebServiceContainer(location, wsdlURL, service, wsdlMap, cl);
 
         InputStream in = cl.getResourceAsStream("echoString-req.txt");
 
-        AxisRequest req =
-            new AxisRequest(
-                504,
-                "text/xml; charset=utf-8",
-                in,
-                0,
-                new HashMap(),
-                location,
-                new HashMap());
-        AxisResponse res =
-            new AxisResponse("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, System.out);
-
-        req.setAttribute(WebServiceContainer.POJO_INSTANCE, pojoClass.newInstance());
-        continaer.invoke(req, res);
-        System.out.flush();
+        try {
+            AxisRequest req =
+                new AxisRequest(
+                    504,
+                    "text/xml; charset=utf-8",
+                    in,
+                    0,
+                    new HashMap(),
+                    location,
+                    new HashMap());
+            AxisResponse res =
+                new AxisResponse("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, System.out);
+        
+            req.setAttribute(WebServiceContainer.POJO_INSTANCE, pojoClass.newInstance());
+            container.invoke(req, res);
+            System.out.flush();
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException ignore) {
+                    // ignore
+                }
+            }
+        }
     }
 
     protected void setUp() throws Exception {