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

BasicImageReader.getResource fails with NPE when no modules in appmodules.jimage

    Details

      Description


      Consider a jre-compact1 build:

      $ images/jre-compact1/bin/java A
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.NullPointerException
      at jdk.internal.jimage.BasicImageReader.getResource(BasicImageReader.java:211)
      at jdk.internal.jimage.PackageModuleMap.readFrom(PackageModuleMap.java:52)
      at jdk.internal.jimage.ImageReader.<init>(ImageReader.java:82)
      at jdk.internal.jimage.ImageReader.open(ImageReader.java:91)
      at jdk.internal.jimage.ImageReader.open(ImageReader.java:98)
      at sun.misc.URLClassPath$JImageLoader.<init>(URLClassPath.java:1129)
      at sun.misc.URLClassPath$3.run(URLClassPath.java:373)
      at sun.misc.URLClassPath$3.run(URLClassPath.java:361)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.misc.URLClassPath.getLoader(URLClassPath.java:360)
      at sun.misc.URLClassPath.getLoader(URLClassPath.java:337)
      at sun.misc.URLClassPath.getResource(URLClassPath.java:203)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:426)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:261)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:359)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:504)

      The issue seems to be that the writer only generates a package map when there are modules in the image, we should either not generate a jimage for this case, have an empty map, or else better handle the case that there isn't a map present.

        Attachments

          Activity

            People

            • Assignee:
              jlaskey Jim Laskey
              Reporter:
              alanb Alan Bateman
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: