cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r475570 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java
Date Thu, 16 Nov 2006 04:17:59 GMT
Author: ema
Date: Wed Nov 15 20:17:58 2006
New Revision: 475570

URL: http://svn.apache.org/viewvc?view=rev&rev=475570
Log:
Fixed WSDLResolver can not resolve http resource issue .
Added close inputstream in WSDlReslover

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java?view=diff&rev=475570&r1=475569&r2=475570
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/wsdl4jutils/WSDLResolver.java
Wed Nov 15 20:17:58 2006
@@ -23,6 +23,7 @@
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLConnection;
 
 import javax.wsdl.xml.WSDLLocator;
 
@@ -58,7 +59,11 @@
         try {
             parentUrl = new URL(parent);
             URL importUrl = new URL(parentUrl, importLocation);
-            if (importUrl.toURI() != null) {
+            if (importUrl != null && !importUrl.getProtocol().startsWith("file"))
{
+                URLConnection con = importUrl.openConnection();
+                con.setUseCaches(false);
+                inputSource = new InputSource(con.getInputStream());
+            } else {
                 File file = new File(importUrl.toURI());
                 if (file.exists()) {
                     URIResolver resolver = new URIResolver(parent.toString(), importLocation);
@@ -69,20 +74,29 @@
                         inputSource = new InputSource(resolver.getInputStream());
                     }
                 }
-                importedUri = importUrl.toURI().toString();
             }
+            importedUri = importUrl.toURI().toString();
+
         } catch (MalformedURLException e) {
-            // TODO
+            //
         } catch (URISyntaxException e) {
-            // TODO
+            //
         } catch (IOException e) {
-            // TODO
+            //
+
         }
         return inputSource;
 
     }
 
     public void close() {
+        if (inputSource.getByteStream() != null) {
+            try {
+                inputSource.getByteStream().close();
+            } catch (IOException e) {
+               //
+            }
+        }
 
     }
 }

Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java?view=diff&rev=475570&r1=475569&r2=475570
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java
Wed Nov 15 20:17:58 2006
@@ -68,7 +68,6 @@
 import org.apache.cxf.tools.validator.internal.WSDL11Validator;
 import org.apache.cxf.tools.wsdl2java.databindings.jaxb.JAXBBindingGenerator;
 
-//import org.apache.cxf.wsdl4jutils.WSDLLocatorImpl;
 import org.apache.cxf.wsdl4jutils.WSDLResolver;
 import org.apache.velocity.app.Velocity;
 
@@ -156,7 +155,6 @@
             InputSource insource = new InputSource(resolver.getInputStream());
             wsdlURL = resolver.getURI().toString();
             wsdlDefinition = wsdlReader.readWSDL(new WSDLResolver(wsdlURL, insource));
-            /*wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(wsdlURL));*/
             
             parseImports(wsdlDefinition);
             buildImportedMaps();



Mime
View raw message