JDK-8201636 : null value when trying to read manifest file attributes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 8u151
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2018-04-16
  • Updated: 2019-01-15
  • Resolved: 2018-05-08
Related Reports
Duplicate :  
Duplicate :  
Relates :  
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



Comments
The root cause of issue was due to the missing entry of "jfxrt.jar" in "meta-index" due to which when we try to load application "MANIFEST.MF", it used to return "jre/lib/ext/jfxrt.jar!/META-INF/MANIFEST.MF". Same issue has been filed in JDK-8193522 and is resolved from 8u171 and 8u172 onward.
15-01-2019

I am getting the output null from JDK 8u152 onwards . But , I have added JDK 8u151 as affected version because with that also I am not getting correct output. JDK 8u144 - Pass (output : Main job catol) JDK 8u151 - Fail (output : International Components for Unicode for Java ) JDK 8u152 - Fail (output: null) JDK 8u161 - Fail (output: null) JDK 8u172-ea b03 - Fail (output: null) JDK 10+46- Pass (output: Main job catol)
19-04-2018