Author: dkulp
Date: Fri Jul 16 15:09:35 2010
New Revision: 964822

URL: http://svn.apache.org/viewvc?rev=964822&view=rev
Log:
[CXF-2896] More fixes for folders with spaces
Patch from William Tam applied

Added:
    cxf/trunk/common/common/src/test/resources/wsdl/folder with spaces/
    cxf/trunk/common/common/src/test/resources/wsdl/folder with spaces/foo.wsdl 
  (with props)
Modified:
    
cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
    
cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java

Modified: 
cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?rev=964822&r1=964821&r2=964822&view=diff
==============================================================================
--- 
cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java 
(original)
+++ 
cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java 
Fri Jul 16 15:09:35 2010
@@ -125,6 +125,10 @@ public class URIResolver {
     private void tryFileSystem(String baseUriStr, String uriStr) throws 
IOException, MalformedURLException {
         try {
             URI relative;
+
+            // It is possible that spaces have been encoded.  We should decode 
them first.
+            uriStr = uriStr.replaceAll("%20", " ");
+
             File uriFile = new File(uriStr);
             uriFile = new File(uriFile.getAbsolutePath());
 

Modified: 
cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java?rev=964822&r1=964821&r2=964822&view=diff
==============================================================================
--- 
cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
 (original)
+++ 
cxf/trunk/common/common/src/test/java/org/apache/cxf/resource/URIResolverTest.java
 Fri Jul 16 15:09:35 2010
@@ -135,5 +135,19 @@ public class URIResolverTest extends Ass
         
     }
 
-
+    @Test
+    public void testBasePathWithSpace() throws Exception {
+        URIResolver wsdlResolver = new URIResolver();
+        // resolve the wsdl
+        wsdlResolver.resolve(null, "wsdl/folder with spaces/foo.wsdl", 
this.getClass());
+        assertTrue(wsdlResolver.isResolved());
+    }
+    
+    @Test
+    public void testBasePathWithEncodedSpace() throws Exception {
+        URIResolver wsdlResolver = new URIResolver();
+        // resolve the wsdl
+        wsdlResolver.resolve(null, "wsdl/folder%20with%20spaces/foo.wsdl", 
this.getClass());
+        assertTrue(wsdlResolver.isResolved());
+    }
 }

Added: cxf/trunk/common/common/src/test/resources/wsdl/folder with 
spaces/foo.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/trunk/common/common/src/test/resources/wsdl/folder%20with%20spaces/foo.wsdl?rev=964822&view=auto
==============================================================================
--- cxf/trunk/common/common/src/test/resources/wsdl/folder with spaces/foo.wsdl 
(added)
+++ cxf/trunk/common/common/src/test/resources/wsdl/folder with spaces/foo.wsdl 
Fri Jul 16 15:09:35 2010
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:tns="http://www.example.org/RelPathDocLit/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="RelPathDocLit"
+       targetNamespace="http://www.example.org/RelPathDocLit/"; 
xmlns:xsd1="urn:RelPath">
+       <wsdl:types>
+               <xsd:schema 
targetNamespace="http://www.example.org/RelPathDocLit/";>
+                       <xsd:element name="NewOperation">
+                               <xsd:complexType>
+                                       <xsd:sequence>
+                                               <xsd:element name="in" 
type="xsd:string" />
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+                       <xsd:element name="NewOperationResponse">
+                               <xsd:complexType>
+                                       <xsd:sequence>
+                                               <xsd:element name="out" 
type="xsd:string" />
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+               </xsd:schema>
+               <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
+                       <xsd:import namespace="urn:RelPath" 
schemaLocation="../schemas/configuration/bar.xsd">
+                       </xsd:import>
+               </xsd:schema>
+       </wsdl:types>
+       <wsdl:message name="RelPathOperationRequest">
+               <wsdl:part name="parameters" type="xsd1:RPTest1CT_In" />
+       </wsdl:message>
+       <wsdl:message name="RelPathOperationResponse">
+               <wsdl:part name="parameters" type="xsd1:RPTest1CT_Out" />
+       </wsdl:message>
+       <wsdl:portType name="RelPathDocLit">
+               <wsdl:operation name="RelPathOperation">
+                       <wsdl:input message="tns:RelPathOperationRequest" />
+                       <wsdl:output message="tns:RelPathOperationResponse" />
+               </wsdl:operation>
+       </wsdl:portType>
+       <wsdl:binding name="RelPathDocLitSOAP" type="tns:RelPathDocLit">
+               <soap:binding style="document"
+                       transport="http://schemas.xmlsoap.org/soap/http"; />
+               <wsdl:operation name="RelPathOperation">
+                       <soap:operation 
soapAction="http://www.example.org/RelPathDocLit/RelPathOperation"; />
+                       <wsdl:input>
+                               <soap:body use="literal" />
+                       </wsdl:input>
+                       <wsdl:output>
+                               <soap:body use="literal" />
+                       </wsdl:output>
+               </wsdl:operation>
+       </wsdl:binding>
+       <wsdl:service name="RelPathDocLit">
+               <wsdl:port binding="tns:RelPathDocLitSOAP" 
name="RelPathDocLitSOAP">
+                       <soap:address 
location="http://localhost:2580/process/RelPathDocLit"; />
+               </wsdl:port>
+       </wsdl:service>
+</wsdl:definitions>

Propchange: cxf/trunk/common/common/src/test/resources/wsdl/folder with 
spaces/foo.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/common/common/src/test/resources/wsdl/folder with 
spaces/foo.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/common/common/src/test/resources/wsdl/folder with 
spaces/foo.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to