You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by "John Kaputin (JIRA)" <ji...@apache.org> on 2007/12/21 14:42:43 UTC

[jira] Commented: (WODEN-191) URISyntaxException in SimpleURIResolver when path contains spaces

    [ https://issues.apache.org/jira/browse/WODEN-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553946 ] 

John Kaputin commented on WODEN-191:
------------------------------------

>From my post to mailing list:

I've checked the history of the SimpleURIResolver code to find out why it 
does URL>URI>URL.openStream(). Prior to r522465 (26/3/07), the code did 
URL>URI>FileInputStream. However this didn't work when the schema.catalog 
was in a jar file so r522465 modified the code to use URL.openStream() 
instead of the FileInputStream. The code change was just to convert the 
URI back to a URL to call the openStream() method.

So, it looks like the URI no longer necessary - just a leftover from the 
FileInputStream approach. My patch removes the URI  conversion step and 
just calls the openStream() method on the original URL, and this does work 
OK when the path contains spaces as in "C:/Program Files/....".  Unless 
there are any objections I'll go ahead and commit the patch.


> 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
>
>         Attachments: woden191_SimplyURIResolver.txt
>
>
> 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/%3cOFF8C5D0A5.1696501D-ON652573B5.0042868E-652573B5.00428F26@polaris.co.in%3e
> 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: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org