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

                 Key: CXF-1584
                 URL: https://issues.apache.org/jira/browse/CXF-1584
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.1
         Environment: Ubuntu 7.04, Windows XP, jdk 1.5_09, cxf 2.1 
            Reporter: Alton Idowu


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


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

Reply via email to