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

DynamicClientFactory throws NullPointerException while building classpath if jar does not have Manifest file

    XMLWordPrintableJSON

    Details

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

      JDK 1.5.0_09, Tomcat 5.5.20, Ubuntu 7.04, Windows XP

    • Estimated Complexity:
      Novice

      Description

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

        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: