8273401: Disable JarIndex support in URLClassPath

Reviewed-by: dfuchs, lancea, alanb, mchung
This commit is contained in:
seanwxiang 2021-09-26 11:43:40 +00:00 committed by Hui Shi
parent 5ec1cdcaf3
commit 7700b25460
3 changed files with 11 additions and 4 deletions

View file

@ -90,6 +90,7 @@ public class URLClassPath {
private static final boolean DISABLE_ACC_CHECKING;
private static final boolean DISABLE_CP_URL_CHECK;
private static final boolean DEBUG_CP_URL_CHECK;
private static final boolean ENABLE_JAR_INDEX;
static {
Properties props = GetPropertyAction.privilegedGetProperties();
@ -109,6 +110,9 @@ public class URLClassPath {
// the check is not disabled).
p = props.getProperty("jdk.net.URLClassPath.showIgnoredClassPathEntries");
DEBUG_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
p = props.getProperty("jdk.net.URLClassPath.enableJarIndex");
ENABLE_JAR_INDEX = p != null ? p.equals("true") || p.isEmpty() : false;
}
/* The original search path of URLs. */
@ -763,8 +767,10 @@ public class URLClassPath {
System.err.println("Opening " + csu);
Thread.dumpStack();
}
jar = getJarFile(csu);
if (!ENABLE_JAR_INDEX) {
return null;
}
index = JarIndex.getJarIndex(jar);
if (index != null) {
String[] jarfiles = index.getJarFiles();