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 ow...@apache.org on 2002/09/27 15:14:10 UTC
cvs commit: xml-axis-wsif/java/src/org/apache/wsif/wsdl WSIFWSDLLocatorImpl.java
owenb 2002/09/27 06:14:10
Modified: java/src/org/apache/wsif/util WSIFUtils.java
java/src/org/apache/wsif/wsdl WSIFWSDLLocatorImpl.java
Log:
Added code to close Reader objects used by the org.apache.wsif.wsdl.WSIFWSDLLocatorImpl class
once the reading of the wsdl is complete
Revision Changes Path
1.18 +26 -10 xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java
Index: WSIFUtils.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WSIFUtils.java 27 Sep 2002 12:53:23 -0000 1.17
+++ WSIFUtils.java 27 Sep 2002 13:14:10 -0000 1.18
@@ -57,6 +57,7 @@
package org.apache.wsif.util;
+import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
@@ -438,7 +439,7 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
try {
@@ -483,12 +484,12 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
+ WSIFWSDLLocatorImpl lo = null;
try {
- WSIFWSDLLocatorImpl lo =
- new WSIFWSDLLocatorImpl(documentBase, reader, cl);
+ lo = new WSIFWSDLLocatorImpl(documentBase, reader, cl);
Definition def = wsdlReader.readWSDL(lo);
Trc.exitExpandWsdl(def);
return def;
@@ -496,6 +497,13 @@
Trc.exception(e);
MessageLogger.log("WSIF.0002E", documentBase);
throw e;
+ } finally {
+ try {
+ if (lo != null) lo.close();
+ } catch (IOException ioe) {
+ //ignore
+ Trc.ignoredException(ioe);
+ }
}
}
@@ -515,13 +523,14 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
+ WSIFWSDLLocatorImpl lo = null;
try {
String url = (contextURL == null) ? null : contextURL.toString();
- WSIFWSDLLocatorImpl lo = new WSIFWSDLLocatorImpl(url, wsdlLoc, cl);
+ lo = new WSIFWSDLLocatorImpl(url, wsdlLoc, cl);
Definition def = wsdlReader.readWSDL(lo);
Trc.exitExpandWsdl(def);
return def;
@@ -529,6 +538,13 @@
Trc.exception(e);
MessageLogger.log("WSIF.0002E", wsdlLoc);
throw e;
+ } finally {
+ try {
+ if (lo != null) lo.close();
+ } catch (IOException ioe) {
+ //ignore
+ Trc.ignoredException(ioe);
+ }
}
}
@@ -544,7 +560,7 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
Definition def =
@@ -565,7 +581,7 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
Definition def = wsdlReader.readWSDL(contextURL, wsdlDocument);
@@ -588,7 +604,7 @@
initializeProviders();
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLReader wsdlReader = factory.newWSDLReader();
wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
Definition def = wsdlReader.readWSDL(contextURL, wsdlServicesElement);
@@ -607,7 +623,7 @@
Trc.entry(null, def, sink);
WSDLFactory factory = WSDLFactory.newInstance(
- WSIFConstants.WSIF_WSDLFACTORY );
+ WSIFConstants.WSIF_WSDLFACTORY);
WSDLWriter wsdlWriter = factory.newWSDLWriter();
wsdlWriter.writeWSDL(def, sink);
1.10 +12 -1 xml-axis-wsif/java/src/org/apache/wsif/wsdl/WSIFWSDLLocatorImpl.java
Index: WSIFWSDLLocatorImpl.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/wsdl/WSIFWSDLLocatorImpl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WSIFWSDLLocatorImpl.java 18 Sep 2002 15:38:19 -0000 1.9
+++ WSIFWSDLLocatorImpl.java 27 Sep 2002 13:14:10 -0000 1.10
@@ -57,14 +57,16 @@
package org.apache.wsif.wsdl;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
-import com.ibm.wsdl.util.StringUtils;
import org.apache.wsif.logging.Trc;
+import com.ibm.wsdl.util.StringUtils;
+
/**
* Implementation of javax.wsdl.xml.WSDLLocator. This class can be used to
* locate a wsdl document and its imports using a ClassLoader. This is useful
@@ -304,6 +306,15 @@
if (found+1 < dd) return null;
return sb2.toString() + sb.toString();
}
+
+ /**
+ * Close any Reader objects that have been created
+ * @throws IOException If a call to close() on one of the Reader objects fails
+ */
+ public void close() throws IOException {
+ if (baseReader != null) baseReader.close();
+ if (importReader != null) importReader.close();
+ }
}