New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8273401: Disable JarIndex support in URLClassPath #5524
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") : false; | ||
} | ||
|
||
/* The original search path of URLs. */ | ||
@@ -763,8 +767,10 @@ public Void run() throws IOException { | ||
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(); | ||
@@ -940,7 +946,7 @@ Resource getResource(final String name, boolean check) { | ||
if (entry != null) | ||
return checkResource(name, check, entry); | ||
|
||
if (index == null) | ||
if (index == null || !ENABLE_JAR_INDEX) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? When ENABLE_JAR_INDEX is false then I assume index will always be null. I'm only asking is that it would be nice if ENABLE_JAR_INDEX was checked in one place rather than two. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the check is redundant, and I removed it. |
||
return null; | ||
|
||
HashSet<String> visited = new HashSet<>(); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should use the same pattern than the other property above:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question is where to document this property. We will obviously need a CSR and releases notes. I also wonder if it should be promoted into a networking property - which would make it possible to document it in the
net.properties
file. @AlanBateman what do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jdk.net.URLClassLoader.enableJarIndex is meant to be a temporary property. We could document it in URLClassLoader as an implNote but I'm not sure that it's worth it. I re-worded the CSR to reflect the current proposal and Wang has submitted it. I noted in the CSR that a release note is planned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the intention is that -Djdk.net.URLClassLoader.enableJarIndex will re-enable the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the reason for specifically checking for a value of true or an empty string as you envision allowing the property to be explicitly set to false in the future?
Otherwise we could just check if the property is set(regardless of value) to re-enable the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would dislike it if
-Djdk.net.URLClassPath.enableJarIndex=false
meant true...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can appreciate that and that is a fair point. I guess where I was coming from was that the property is temporary and has to be explicitly specified so ignoring the value seemed worth raising/discussing.
Assuming the current check is kept(which we should based on your input), it should probably be changed to ignore case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that there is a precedence in this file:
I would tend to let the new property follow the same pattern, especially since it's temporary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,I changed the code to follow the same pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough :-)