cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r983792 - in /cxf/branches/2.2.x-fixes: ./ tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
Date Mon, 09 Aug 2010 19:41:00 GMT
Author: dkulp
Date: Mon Aug  9 19:40:59 2010
New Revision: 983792

URL: http://svn.apache.org/viewvc?rev=983792&view=rev
Log:
Merged revisions 980880 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r980880 | ema | 2010-07-30 12:07:40 -0400 (Fri, 30 Jul 2010) | 1 line
  
  [CXF-2918]:normalize the url like file:/home/cxf/org/apache/../../cxf in URIParserUtil.getAbsoluteURL()
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
    cxf/branches/2.2.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java?rev=983792&r1=983791&r2=983792&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
Mon Aug  9 19:40:59 2010
@@ -248,18 +248,15 @@ public final class URIParserUtil {
     }
     public static String normalize(final String uri) {
         URL url = null;
+        String result = null;
         try {
             url = new URL(uri);
-            return escapeChars(url.toString().replace("\\", "/"));
+            result = escapeChars(url.toURI().normalize().toString().replace("\\", "/"));
         } catch (MalformedURLException e1) {
             try {
-                if (uri.startsWith("classpath:")) {
-                    
+                if (uri.startsWith("classpath:")) {                  
                     url = ClassLoaderUtils.getResource(uri.substring(10), URIParserUtil.class);
-                    if (url != null) {
-                        return url.toExternalForm();
-                    }
-                    return uri;
+                    return url != null ? url.toExternalForm() : uri;
                 }
                 File file = new File(uri);
                 if (file.exists()) {
@@ -276,7 +273,12 @@ public final class URIParserUtil {
             } catch (Exception e2) {
                 return escapeChars(uri.replace("\\", "/"));
             }
+        } catch (URISyntaxException e) {
+            if (url != null) {
+                result = escapeChars(url.toString().replace("\\", "/"));
+            }
         }
+        return result;
     }
 
     public static String getAbsoluteURI(final String arg) {

Modified: cxf/branches/2.2.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java?rev=983792&r1=983791&r2=983792&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
Mon Aug  9 19:40:59 2010
@@ -56,6 +56,9 @@ public class URIParserUtilTest extends A
 
         uri = "/c:\\hello.wsdl";
         assertEquals("file:/c:/hello.wsdl", URIParserUtil.normalize(uri));
+        
+        uri = "file:/home/john/test/all/../../alltest";
+        assertEquals("file:/home/john/alltest", URIParserUtil.normalize(uri));
     }
 
     @Test



Mime
View raw message