URISyntaxException in SimpleURIResolver when path contains spaces
-----------------------------------------------------------------

                 Key: WODEN-191
                 URL: https://issues.apache.org/jira/browse/WODEN-191
             Project: Woden
          Issue Type: Bug
            Reporter: John Kaputin
            Assignee: John Kaputin
             Fix For: M8


A Woden user has reported a URISyntaxException error in SimpleURIResolver when 
deploying a WSDL 2.0 application to Tomcat. The stack trace shows this is 
caused by a space in that the path string passed to the URI ctor in 
SimpleURIResolver.loadCatalog. This path string is of the form "C:/Program 
Files/...." - according to RFC2396 the space is an illegal character in a URI. 
It should be escaped to "%20".  This path string comes from the URL created in 
the SimpleURIResolver constructor by the ClassLoader.getResource method, using 
the string "META-INF/schema.catalog".

Original mailing list post with stack trace:
http://mail-archives.apache.org/mod_mbox/ws-woden-dev/200712.mbox/[EMAIL 
PROTECTED]

I have tested Woden using the IBM 1.42 and Sun 1.42 JREs and cannot recreate 
the problem. In both cases, the JRE classloader's getResource method does the 
escaping, replacing spaces with %20. It might be that Tomcat is using its own 
classloader with different behaviour (i.e. not escaping spaces). 

Having reviewed the code in SimpleURIResolver, it seems the use of the URI 
class is unnecessary. The code creates a URL as described above, then converts 
it to a URI, then converts it back to a URL and calls the openStream() method 
on the new URL to retrieve the contents of the schema.catalog file. We can 
probably eliminate this type of error by removing the URI step and just calling 
openStream() on the original URL. 

I have tested the openStream() method using a URL file path with spaces and 
then with the spaces escaped and it works correctly in both cases:

//URL schemaCatalogURL = new URL("file:/C:/Program 
Files/woden/META-INF/schema.catalog");
URL schemaCatalogURL = new 
URL("file:/C:/Program%20Files/woden/META-INF/schema.catalog");
Properties catalog = new Properties();
catalog.load(schemaCatalogURL.openStream());

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to