8164585: JarFile::isMultiRelease does not return true in all cases where it should return true
authorsdrach
Tue, 23 Aug 2016 11:26:41 -0700
changeset 40539 12bb7768ae6e
parent 40538 86086b400786
child 40540 49fd4217ac48
8164585: JarFile::isMultiRelease does not return true in all cases where it should return true Reviewed-by: alanb, psandoz Contributed-by: steve.drach@oracle.com
jdk/src/java.base/share/classes/java/util/jar/JarFile.java
jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Aug 23 15:44:01 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Aug 23 11:26:41 2016 -0700
@@ -353,7 +353,7 @@
         if (isMultiRelease) {
             return true;
         }
-        if (MULTI_RELEASE_ENABLED && versionMajor != BASE_VERSION_MAJOR) {
+        if (MULTI_RELEASE_ENABLED) {
             try {
                 checkForSpecialAttributes();
             } catch (IOException io) {
@@ -644,7 +644,7 @@
             return signers == null ? null : signers.clone();
         }
         JarFileEntry realEntry() {
-            if (isMultiRelease()) {
+            if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) {
                 String entryName = super.getName();
                 return entryName.equals(this.name) ? this : new JarFileEntry(entryName, this);
             }
@@ -960,7 +960,7 @@
                 hasClassPathAttribute = match(CLASSPATH_CHARS, b,
                         CLASSPATH_LASTOCC) != -1;
                 // is this a multi-release jar file
-                if (MULTI_RELEASE_ENABLED && versionMajor != BASE_VERSION_MAJOR) {
+                if (MULTI_RELEASE_ENABLED) {
                     int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
                     if (i != -1) {
                         i += MULTIRELEASE_CHARS.length;
--- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Tue Aug 23 15:44:01 2016 -0700
+++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Tue Aug 23 11:26:41 2016 -0700
@@ -80,7 +80,7 @@
         }
 
         try (JarFile jf = new JarFile(multirelease)) {
-            Assert.assertFalse(jf.isMultiRelease());
+            Assert.assertTrue(jf.isMultiRelease());
         }
 
         try (JarFile jf = new JarFile(multirelease, true, ZipFile.OPEN_READ, Runtime.version())) {