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

DynamicClientFactory.setupClasspath method throws Exception if jar file does not exist

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.1.1
    • Core
    • None
    • Ubuntu 7.04, Windows XP, jdk 1.5_09, cxf 2.1

    Description

      If a jar file reported by the classloader does not exist, the following exception is thrown:

      Caused by: java.util.zip.ZipException: No such file or directory
      at java.util.zip.ZipFile.open(Native Method)
      at java.util.zip.ZipFile.<init>(ZipFile.java:203)
      at java.util.jar.JarFile.<init>(JarFile.java:132)
      at java.util.jar.JarFile.<init>(JarFile.java:97)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.addClasspathFromManifest(DynamicClientFactory.java:366)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.setupClasspath(DynamicClientFactory.java:422)
      at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:214)
      ... 54 more

      As the code does not display the file in question, it is a very tedious process to find the issue in the classpath. It would be prefferable if the code would ignore any missing jar file. Another possible solution (though less preferrable) would be to print the jar files as they are added.

      Code in question:
      if (file.exists())

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

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

      { addClasspathFromManifest(classPath, file); }

      The following code should fix the issue:

      if (file.exists()) {
      classPath.append(file.getAbsolutePath())
      .append(System
      .getProperty("path.separator"));
      if (file.getName().endsWith(".jar"))

      { addClasspathFromManifest(classPath, file); }

      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: