cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r525949 - in /incubator/cxf/trunk/common/common/src: main/java/org/apache/cxf/resource/URIResolver.java test/java/org/apache/cxf/resource/URIResolverTest.java test/java/org/apache/cxf/resource/resources/helloworld.bpr
Date Thu, 05 Apr 2007 19:40:42 GMT
Author: gawor
Date: Thu Apr  5 12:40:41 2007
New Revision: 525949

URL: http://svn.apache.org/viewvc?view=rev&rev=525949
Log:
Check jar file first before doing classpath search when resolving entires (CXF-494)

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
    incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/resources/helloworld.bpr

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?view=diff&rev=525949&r1=525948&r2=525949
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
Thu Apr  5 12:40:41 2007
@@ -171,10 +171,14 @@
         if (i == -1) {
             tryFileSystem(baseStr, uriStr);
         }
-        baseStr = baseStr.substring(i + 1);
+
+        String jarBase = baseStr.substring(0, i + 1);
+        String jarEntry = baseStr.substring(i + 1);
         try {
-            URI u = new URI(baseStr).resolve(uriStr);
-            tryClasspath(u.toString());
+            URI u = new URI(jarEntry).resolve(uriStr);
+
+            tryJar(jarBase + u.toString());
+
             if (is != null) {
                 if (u.isAbsolute()) {
                     url = u.toURL();
@@ -195,14 +199,14 @@
         }
 
         url = new URL(uriStr);
-        is = url.openStream();
-        if (is != null) {
+        try {
+            is = url.openStream();
             try {
                 uri = url.toURI();
             } catch (URISyntaxException ex) {
                 // ignore
             }
-        } else {
+        } catch (IOException e) {
             uriStr = uriStr.substring(i + 1);
             tryClasspath(uriStr);
         }

Modified: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java?view=diff&rev=525949&r1=525948&r2=525949
==============================================================================
--- incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
(original)
+++ incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
Thu Apr  5 12:40:41 2007
@@ -62,4 +62,27 @@
         }       
         assertEquals(new String(barray), new String(barray2));
     }
+
+    @Test
+    public void testJARResolver() throws Exception {
+        uriResolver = new URIResolver();
+        
+        String uriStr = "jar:" + resourceURL.toString() + "!/wsdl/hello_world.wsdl";
+        
+        URL jarURL = new URL(uriStr);
+        InputStream is = jarURL.openStream();
+        assertNotNull(is);
+
+        String uriStr2 = "jar:" + resourceURL.toString() + "!/wsdl/hello_world_2.wsdl";
+        
+        URL jarURL2 = new URL(uriStr2);
+        InputStream is2 = jarURL2.openStream();
+        assertNotNull(is2);
+        
+        uriResolver.resolve(uriStr, "hello_world_2.wsdl", null);
+        
+        InputStream is3 = uriResolver.getInputStream();
+        assertNotNull(is3); 
+    }
+
 }

Modified: incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/resources/helloworld.bpr
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/resources/helloworld.bpr?view=diff&rev=525949&r1=525948&r2=525949
==============================================================================
Binary files - no diff available.



Mime
View raw message