JDK-8150163 : JarFileSystem support for MRJARs should use the JDK specific Version API
  • Type: Bug
  • Component: core-libs
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-18
  • Updated: 2016-03-03
  • Resolved: 2016-02-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b107Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
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");