Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8201636

null value when trying to read manifest file attributes

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 16.04 and Windows 10

      A DESCRIPTION OF THE PROBLEM :
      Cannot read manifest entries from jar file.

      REGRESSION : Last worked in version 8u151

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Bundle the class and the manifest file in a jar file and launch: java -jar test.jar


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should print "Main job catol"
      ACTUAL -
      It always prints "null".

      ---------- BEGIN SOURCE ----------
      put the following code in a method, create an instance and call from main:

      InputStream stream = getClass().getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF");
      Manifest manifest = new Manifest(stream);
      Attributes attributes = manifest.getMainAttributes();
      System.out.System.out.println( attributes.getValue("Implementation-Title") );
      ---------------------------------------------
      Content of META-INF/MANIFEST.MF:

      Manifest-Version: 1.0
      Implementation-Title: Main job catol
      Implementation-Version: SNAPSHOT
      Implementation-Vendor-Id: it.next.catol
      Specification-Title: Main job catol
      Created-By: Apache Maven 3.3.9
      Build-Jdk: 1.8.0_151
      Specification-Version: 0.0.1-SNAPSHOT
      X-SCM-Revision: DEV
      -------

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Roll back to jdk8u151

      FREQUENCY : always


      Attachments

        1. JI9053398.jar
          1 kB
        2. JI9053398.java
          0.5 kB
        3. MANIFEST.MF
          0.3 kB

        Issue Links

          Activity

            People

              dkejriwal Deepak Kejriwal (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: