cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r472798 - in /incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource: ExtendedURIResolver.java URIResolver.java
Date Thu, 09 Nov 2006 07:06:28 GMT
Author: tli
Date: Wed Nov  8 23:06:28 2006
New Revision: 472798

URL: http://svn.apache.org/viewvc?view=rev&rev=472798
Log:
fix bug for file: leak of URI resolvers

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java?view=diff&rev=472798&r1=472797&r2=472798
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
Wed Nov  8 23:06:28 2006
@@ -64,6 +64,7 @@
                         check = new URI(baseUri);
                     }
                 } else {
+                    baseUri = baseUri.startsWith("file:") ? baseUri : "file:" + baseUri;
                     check = new URI(baseUri);
                 }
                 if (check.isAbsolute()) {

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=472798&r1=472797&r2=472798
==============================================================================
--- 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
Wed Nov  8 23:06:28 2006
@@ -157,25 +157,26 @@
             if (!(new URI(uriStr)).isAbsolute()) {
                 history.push(new Location(baseUriStr, uriStr));
             } 
+            if (finalRelative != null) {
+                File targetFile = new File(finalRelative.toString().startsWith("file:") ?
finalRelative 
+                    : new URI("file:" + finalRelative.toString()));
+                if (!targetFile.exists()) {
+                    tryClasspath(finalRelative.toString().substring(5));
+                    return;
+                }
+                URI target;
+                if (targetFile.exists()) {
+                    target = targetFile.toURI();
+                } else {
+                    target = finalRelative;
+                }
+                if (target.isAbsolute()) {
+                    uri = target;                
+                    is = target.toURL().openStream();
+                }
+            }
         } catch (URISyntaxException ue) {
             // move on
-        }
-        if (finalRelative != null) {
-            File targetFile = new File(finalRelative);
-            if (!targetFile.exists()) {
-                tryClasspath(finalRelative.toString().substring(5));
-                return;
-            }
-            URI target;
-            if (targetFile.exists()) {
-                target = targetFile.toURI();
-            } else {
-                target = finalRelative;
-            }
-            if (target.isAbsolute()) {
-                uri = target;                
-                is = target.toURL().openStream();
-            }
         }
     }
     



Mime
View raw message