8164585: JarFile::isMultiRelease does not return true in all cases where it should return true

Reviewed-by: alanb, psandoz
This commit is contained in:
Steve Drach 2016-08-23 11:26:41 -07:00 committed by Steve Drach
parent f3e6d78c81
commit 3a04923cad
2 changed files with 4 additions and 4 deletions
jdk
src/java.base/share/classes/java/util/jar
test/java/util/jar/JarFile/mrjar

@ -353,7 +353,7 @@ class JarFile extends ZipFile {
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 @@ class JarFile extends ZipFile {
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 @@ class JarFile extends ZipFile {
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;

@ -80,7 +80,7 @@ public class MultiReleaseJarAPI {
}
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())) {