--- old/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java 2019-09-22 18:39:08.000000000 -0400 +++ new/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java 2019-09-22 18:39:08.000000000 -0400 @@ -60,18 +60,18 @@ JarFileSystem(ZipFileSystemProvider provider, Path zfpath, Map env) throws IOException { super(provider, zfpath, env); - if (isMultiReleaseJar()) { + Object o = getRuntimeVersion(env); + if (isMultiReleaseJar() && (o != null)) { int version; - Object o = env.get("multi-release"); if (o instanceof String) { String s = (String)o; if (s.equals("runtime")) { version = Runtime.version().feature(); } else { - version = Integer.parseInt(s); + version = Version.parse(s).feature(); } } else if (o instanceof Integer) { - version = (Integer)o; + version = Version.parse(((Integer)o).toString()).feature(); } else if (o instanceof Version) { version = ((Version)o).feature(); } else { @@ -83,6 +83,24 @@ } } + /** + * Utility method to get the release version for a multi-release JAR. It + * first checks the documented property {@code releaseVersion} and if not + * found checks the original property {@code multi-release} + * @param env ZIP FS map + * @return release version or null if it is not specified + */ + private Object getRuntimeVersion(Map env) { + + Object o = null; + if( env.containsKey(ZipFileSystemProvider.RELEASE_VERSION)) { + o = env.get(ZipFileSystemProvider.RELEASE_VERSION); + } else { + o = env.get(ZipFileSystemProvider.MULTI_RELEASE); + } + return o; + } + private boolean isMultiReleaseJar() throws IOException { try (InputStream is = newInputStream(getBytes("/META-INF/MANIFEST.MF"))) { String multiRelease = new Manifest(is).getMainAttributes()