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

LauncherHelper.checkAndLoadMain closes jar file that's about to be re-opened

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 23
    • None
    • tools
    • b11

    Description

      LauncherHelper.getMainClassFromJar takes a String as parameter corresponding to a jar file where the "Main-Class" attribute needs to be determined. It returns a Class reference.

      However, it closes the jar file that the JDK has just spent time in opening and parsing (building CEN structure etc) :

      at java.base/java.util.zip.ZipFile$Source.release(ZipFile.java:1482)
      at java.base/java.util.zip.ZipFile$CleanableResource.run(ZipFile.java:804)
      at java.base/jdk.internal.ref.CleanerImpl$PhantomCleanableRef.performCleanup(CleanerImpl.java:178)
      at java.base/jdk.internal.ref.PhantomCleanable.clean(PhantomCleanable.java:133)
      at java.base/java.util.zip.ZipFile$CleanableResource.clean(ZipFile.java:728)
      at java.base/java.util.zip.ZipFile.close(ZipFile.java:837)
      at java.base/sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:676)
      at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:848)
      at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:756)

      The launcher process would benefit from a performance gain (avoid rebuilding the zip index) if the jar file remains opened. The Class returned is about to be loaded and the jar file will be opened again (with current code).

      Attachments

        Issue Links

          Activity

            People

              cstein Christian Stein
              coffeys Sean Coffey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: