mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8337494: Clarify JarInputStream behavior
Backport-of: 353f6e90bec7248016b2c733bae52ed6ca06fc20
This commit is contained in:
committed by
Sergey Shelomentsev
parent
b7a165efd6
commit
056e46f364
@@ -421,7 +421,8 @@ public class JarFile extends ZipFile {
|
||||
jv = new JarVerifier(manEntry.getName(), b);
|
||||
} else {
|
||||
if (JarVerifier.debug != null) {
|
||||
JarVerifier.debug.println("Multiple MANIFEST.MF found. Treat JAR file as unsigned");
|
||||
JarVerifier.debug.println(
|
||||
JarVerifier.MULTIPLE_MANIFEST_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,17 @@ public class JarInputStream extends ZipInputStream {
|
||||
jv = new JarVerifier(e.getName(), bytes);
|
||||
mev = new ManifestEntryVerifier(man, jv.manifestName);
|
||||
}
|
||||
return (JarEntry)super.getNextEntry();
|
||||
JarEntry nextEntry = (JarEntry)super.getNextEntry();
|
||||
if (nextEntry != null &&
|
||||
JarFile.MANIFEST_NAME.equalsIgnoreCase(nextEntry.getName())) {
|
||||
if (JarVerifier.debug != null) {
|
||||
JarVerifier.debug.println(JarVerifier.MULTIPLE_MANIFEST_WARNING);
|
||||
}
|
||||
|
||||
jv = null;
|
||||
mev = null;
|
||||
}
|
||||
return nextEntry;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -46,6 +46,9 @@ import static sun.security.util.SignatureFileVerifier.isInMetaInf;
|
||||
*/
|
||||
class JarVerifier {
|
||||
|
||||
public static final String MULTIPLE_MANIFEST_WARNING =
|
||||
"WARNING: Multiple MANIFEST.MF found. Treat JAR file as unsigned.";
|
||||
|
||||
/* Are we debugging ? */
|
||||
static final Debug debug = Debug.getInstance("jar");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user