DynamicClientFactory throws NullPointerException while building classpath if
jar does not have Manifest file
------------------------------------------------------------------------------------------------------------
Key: CXF-1567
URL: https://issues.apache.org/jira/browse/CXF-1567
Project: CXF
Issue Type: Bug
Components: Core
Affects Versions: 2.1
Environment: Windows XP and Ubuntu 7.04
Reporter: Alton Idowu
While attempting to use the following code snippet:
DynamicClientFactory dcf = DynamicClientFactory.newInstance();
Client client = dcf.createClient(wsdlUrl);
The factory throws a NullPointerException without a helpuful stack trace. The
issue was caused by a jar file that did not have a manifest file.
static void addClasspathFromManifest(StringBuilder classPath, File file)
throws URISyntaxException, IOException {
JarFile jar = new JarFile(file);
Attributes attr = jar.getManifest().getMainAttributes();
^^^^^^^^^^^^^
The following code should fix the issue:
Attributes attr = null;
if (jar.getManifest() != null) {
attr = jar.getManifest().getMainAttributes();
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.