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

JarFileSystem support for MRJARs should use the JDK specific Version API

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Resolved In Build:
      b107

      Description

      Currently JarFileSystem uses sun.misc.Version to retrieve the major version. It should be updated to use the new JDK specific Version API.

      diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java
      --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java
      +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java
      @@ -36,6 +36,7 @@
       import java.util.function.Function;
       import java.util.jar.Attributes;
       import java.util.jar.Manifest;
      +import jdk.Version;
       
       /**
        * Adds aliasing to ZipFileSystem to support multi-release jar files. An alias map
      @@ -68,14 +69,14 @@
                   if (o instanceof String) {
                       String s = (String)o;
                       if (s.equals("runtime")) {
      - version = sun.misc.Version.jdkMajorVersion(); // fixme waiting for jdk.util.Version
      + version = jdk.Version.current().major();
                       } else {
                           version = Integer.parseInt(s);
                       }
                   } else if (o instanceof Integer) {
                       version = (Integer)o;
      - } else if (false /*o instanceof Version*/) { // fixme waiting for jdk.util.Version
      -// version = ((Version)o).major();
      + } else if (o instanceof Version) {
      + version = ((Version)o).major();
                   } else {
                       throw new IllegalArgumentException("env parameter must be String, Integer, "
                               + "or Version");

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chegar Chris Hegarty
                Reporter:
                chegar Chris Hegarty
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: