8317141: Remove unused validIndex method from URLClassPath$JarLoader
Reviewed-by: alanb, lancea, dfuchs
This commit is contained in:
parent
47569a256c
commit
009f5e1fa1
@ -433,9 +433,7 @@ public class URLClassPath {
|
|||||||
if (url == null)
|
if (url == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Skip this URL if it already has a Loader. (Loader
|
// Skip this URL if it already has a Loader.
|
||||||
// may be null in the case where URL has not been opened
|
|
||||||
// but is referenced by a JAR index.)
|
|
||||||
String urlNoFragString = URLUtil.urlNoFragString(url);
|
String urlNoFragString = URLUtil.urlNoFragString(url);
|
||||||
if (lmap.containsKey(urlNoFragString)) {
|
if (lmap.containsKey(urlNoFragString)) {
|
||||||
continue;
|
continue;
|
||||||
@ -489,12 +487,12 @@ public class URLClassPath {
|
|||||||
// extract the nested URL
|
// extract the nested URL
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
URL nestedUrl = new URL(file.substring(0, file.length() - 2));
|
URL nestedUrl = new URL(file.substring(0, file.length() - 2));
|
||||||
return new JarLoader(nestedUrl, jarHandler, lmap, acc);
|
return new JarLoader(nestedUrl, jarHandler, acc);
|
||||||
} else {
|
} else {
|
||||||
return new Loader(url);
|
return new Loader(url);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new JarLoader(url, jarHandler, lmap, acc);
|
return new JarLoader(url, jarHandler, acc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, acc);
|
}, acc);
|
||||||
@ -708,8 +706,6 @@ public class URLClassPath {
|
|||||||
private static class JarLoader extends Loader {
|
private static class JarLoader extends Loader {
|
||||||
private JarFile jar;
|
private JarFile jar;
|
||||||
private final URL csu;
|
private final URL csu;
|
||||||
private URLStreamHandler handler;
|
|
||||||
private final HashMap<String, Loader> lmap;
|
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
private final AccessControlContext acc;
|
private final AccessControlContext acc;
|
||||||
private boolean closed = false;
|
private boolean closed = false;
|
||||||
@ -721,14 +717,11 @@ public class URLClassPath {
|
|||||||
* a JAR file.
|
* a JAR file.
|
||||||
*/
|
*/
|
||||||
private JarLoader(URL url, URLStreamHandler jarHandler,
|
private JarLoader(URL url, URLStreamHandler jarHandler,
|
||||||
HashMap<String, Loader> loaderMap,
|
|
||||||
@SuppressWarnings("removal") AccessControlContext acc)
|
@SuppressWarnings("removal") AccessControlContext acc)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
super(newURL("jar", "", -1, url + "!/", jarHandler));
|
super(newURL("jar", "", -1, url + "!/", jarHandler));
|
||||||
csu = url;
|
csu = url;
|
||||||
handler = jarHandler;
|
|
||||||
lmap = loaderMap;
|
|
||||||
this.acc = acc;
|
this.acc = acc;
|
||||||
|
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
@ -752,10 +745,6 @@ public class URLClassPath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JarFile getJarFile () {
|
|
||||||
return jar;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOptimizable(URL url) {
|
private boolean isOptimizable(URL url) {
|
||||||
return "file".equals(url.getProtocol());
|
return "file".equals(url.getProtocol());
|
||||||
}
|
}
|
||||||
@ -871,33 +860,6 @@ public class URLClassPath {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns true iff at least one resource in the jar file has the same
|
|
||||||
* package name as that of the specified resource name.
|
|
||||||
*/
|
|
||||||
boolean validIndex(final String name) {
|
|
||||||
String packageName = name;
|
|
||||||
int pos;
|
|
||||||
if ((pos = name.lastIndexOf('/')) != -1) {
|
|
||||||
packageName = name.substring(0, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
String entryName;
|
|
||||||
ZipEntry entry;
|
|
||||||
Enumeration<JarEntry> enum_ = jar.entries();
|
|
||||||
while (enum_.hasMoreElements()) {
|
|
||||||
entry = enum_.nextElement();
|
|
||||||
entryName = entry.getName();
|
|
||||||
if ((pos = entryName.lastIndexOf('/')) != -1)
|
|
||||||
entryName = entryName.substring(0, pos);
|
|
||||||
if (entryName.equals(packageName)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the URL for a resource with the specified name
|
* Returns the URL for a resource with the specified name
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user