Uploaded image for project: 'Woden'
  1. Woden
  2. WODEN-191

URISyntaxException in SimpleURIResolver when path contains spaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • M8
    • None
    • None

    Description

      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());

      Attachments

        1. woden191_SimplyURIResolver.txt
          1 kB
          John Alan William Kaputin

        Activity

          People

            jkaputin John Alan William Kaputin
            jkaputin John Alan William Kaputin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: