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
--- 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())) {