Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1583

DynamicClientFactory.setupClasspath method cannot handle spaces in path to jar file

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.1
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Ubuntu 7.04, Windows XP, jdk 1.5_09, cxf 2.1

    • Estimated Complexity:
      Novice

      Description

      The setupClasspath method in the DynamicClientFactory class cannot handle spaces in the path to jar files. It throws the following exception:

      Caused by: java.net.URISyntaxException: Illegal character in path at index 16: file:/C:/Program Files/Apache/Tomcat-5.5.20/common/i18n/tomcat-i18n-en.jar
      at java.net.URI$Parser.fail(URI.java:2816)
      at java.net.URI$Parser.checkChars(URI.java:2989)
      at java.net.URI$Parser.parseHierarchical(URI.java:3073)
      at java.net.URI$Parser.parse(URI.java:3021)
      at java.net.URI.<init>(URI.java:578)
      at java.net.URL.toURI(URL.java:916)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:405)

      This is a know issue withthe URL.toURI() method.

      A possible solution would be to replace the following:
      if (url.getProtocol().startsWith("file")) {
      try {
      File file = new File(url.toURI().getPath());
      if (file.exists())

      { classPath.append(file.getAbsolutePath()) .append(System .getProperty("path.separator")); }

      if (file.getName().endsWith(".jar"))

      { addClasspathFromManifest(classPath, file); }

      } catch (URISyntaxException e)

      { throw new UncheckedException(e); }

      }

      with
      if (url.getProtocol().startsWith("file")) {
      File file;
      try

      { file = new File(url.toURI().getPath()); }

      catch (catch catch(URISyntaxException urise)

      { file = new File(url.getPath()); }

      if (file.exists())

      { classPath.append(file.getAbsolutePath()) .append(System .getProperty("path.separator")); }

      if (file.getName().endsWith(".jar"))

      { addClasspathFromManifest(classPath, file); }

      }

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              uwodi Alton Idowu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: