cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r934278 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/resource/ common/common/src/test/java/org/apache/cxf/resource/ common/common/src/test/resources/schemas/configuration/folder with spaces/
Date Thu, 15 Apr 2010 03:29:15 GMT
Author: dkulp
Date: Thu Apr 15 03:29:14 2010
New Revision: 934278

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

........
  r934270 | dkulp | 2010-04-14 23:03:57 -0400 (Wed, 14 Apr 2010) | 2 lines
  
  [CXF-2765] Support imports in folders with spaces
  Patch from William Tam applied
........

Added:
    cxf/branches/2.2.x-fixes/common/common/src/test/resources/schemas/configuration/folder
with spaces/
      - copied from r934270, cxf/trunk/common/common/src/test/resources/schemas/configuration/folder
with spaces/
    cxf/branches/2.2.x-fixes/common/common/src/test/resources/schemas/configuration/folder
with spaces/bar.xsd
      - copied unchanged from r934270, cxf/trunk/common/common/src/test/resources/schemas/configuration/folder
with spaces/bar.xsd
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
    cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java

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

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?rev=934278&r1=934277&r2=934278&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
Thu Apr 15 03:29:14 2010
@@ -181,7 +181,8 @@ public class URIResolver {
                 base = base.resolve(relative);
                 if (base.isAbsolute() && "file".equalsIgnoreCase(base.getScheme()))
{
                     try {
-                        baseFile = new File(base);
+                        // decode space before create a file
+                        baseFile = new File(base.getPath().replace("%20", " "));
                         if (baseFile.exists()) {
                             is = base.toURL().openStream();
                             uri = base;
@@ -253,7 +254,8 @@ public class URIResolver {
             } 
         }
         
-        return path;
+        // decode spaces before returning otherwise File.exists returns false 
+        return path.replace("%20", " ");
     }
 
     private void tryArchive(String baseStr, String uriStr) throws IOException {

Modified: cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java?rev=934278&r1=934277&r2=934278&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
Thu Apr 15 03:29:14 2010
@@ -110,5 +110,30 @@ public class URIResolverTest extends Ass
         assertNotNull(xsdResolver.getInputStream());
         
     }
+    
+    @Test
+    public void testResolvePathWithSpace() throws Exception {
+        URIResolver wsdlResolver = new URIResolver();
+
+        // resolve the wsdl
+        wsdlResolver.resolve(null, "wsdl/foo.wsdl", this.getClass());
+        assertTrue(wsdlResolver.isResolved());
+        
+        // get the base uri from the resolved wsdl location
+        String baseUri = wsdlResolver.getURI().toString();
+        
+        // resolve the schema using relative location
+        String schemaLocation = "../schemas/configuration/folder with spaces/bar.xsd";
+        URIResolver xsdResolver = new URIResolver();
+        xsdResolver.resolve(baseUri, schemaLocation, this.getClass());
+        assertNotNull(xsdResolver.getInputStream());
+        
+        // resolve the schema using relative location with base uri fragment
+        xsdResolver = new URIResolver();
+        xsdResolver.resolve(baseUri + "#type2", schemaLocation, this.getClass());
+        assertNotNull(xsdResolver.getInputStream());
+        
+    }
+
 
 }



Mime
View raw message