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

Meta-index prevents JDK MANIFEST.MF files from being found by ClassLoader.getResources()

    Details

    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 16.04.6 LTS
      CPU model: Intel(R) Xeon(R) CPU E5-4610 v4 @ 1.80GHz
      Number of CPU cores: 4CPUs, each has 10 cores
      Size of physical memory: 16384 MB * 20
      Inside Linux container? No

      A DESCRIPTION OF THE PROBLEM :
      When executing the code ClassLoader.getResources("META-INF/MANIFEST.MF"):
      J9 (8u232) can find several URLs:
      "jar:file:/home/JVMs/j9-8u232-b09/jre/lib/rt.jar!/META-INF/MANIFEST.MF
      jar:file:/home/JVMs/j9-8u232-b09/jre/lib/resources.jar!/META-INF/MANIFEST.MF
      jar:file:/home/JVMs/j9-8u232-b09/jre/lib/jsse.jar!/META-INF/MANIFEST.MF
      jar:file:/home/JVMs/j9-8u232-b09/jre/lib/charsets.jar!/META-INF/MANIFEST.MF
      jar:file:/home/JVMs/j9-8u232-b09/jre/lib/jce.jar!/META-INF/MANIFEST.MF"
      But even though those jar files and MF files exist in the path $OpenJDK8u232Path/jre/lib/, OpenJDK8u232 returns nothing.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a new file "test2.java", copy the source code into it.
      2. Compile the java file "test2.java".
      3. Run the command "java test2".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      print:
      "jar:file:$OpenJDK8u232Path/jre/lib/rt.jar!/META-INF/MANIFEST.MF
      jar:file:$OpenJDK8u232Path/jre/lib/resources.jar!/META-INF/MANIFEST.MF
      jar:file:$OpenJDK8u232Path/jre/lib/jsse.jar!/META-INF/MANIFEST.MF
      jar:file:$OpenJDK8u232Path/jre/lib/charsets.jar!/META-INF/MANIFEST.MF
      jar:file:$OpenJDK8u232Path/jre/lib/jce.jar!/META-INF/MANIFEST.MF"
      ACTUAL -
      print nothing

      ---------- BEGIN SOURCE ----------
      import java.net.URL;
      import java.util.Enumeration;

      public class test2{
          public static void main(String[] args) {
              try {
                  // AppClassLoader
                  ClassLoader cl = Class.forName("test2").getClassLoader();
                  Enumeration<URL> e = cl.getResources("META-INF/MANIFEST.MF");
                  while(e.hasMoreElements()){
                      System.out.println(e.nextElement().toString());
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              bchristi Brent Christian
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: