8139820: URLClassPath.FileLoader constructor redundantly checks protocol

Reviewed-by: chegar, redestad
This commit is contained in:
Evgeny Mandrikov 2019-08-21 00:08:35 +02:00
parent f83ac54e23
commit 444e784ce1

View file

@ -699,7 +699,7 @@ public class URLClassPath {
/* /*
* Nested class used to represent a Loader of resources from a JAR URL. * Nested class used to represent a Loader of resources from a JAR URL.
*/ */
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 JarIndex index; private JarIndex index;
@ -714,7 +714,7 @@ public class URLClassPath {
* Creates a new JarLoader for the specified URL referring to * Creates a new JarLoader for the specified URL referring to
* a JAR file. * a JAR file.
*/ */
JarLoader(URL url, URLStreamHandler jarHandler, private JarLoader(URL url, URLStreamHandler jarHandler,
HashMap<String, Loader> loaderMap, HashMap<String, Loader> loaderMap,
AccessControlContext acc) AccessControlContext acc)
throws IOException throws IOException
@ -1193,11 +1193,11 @@ public class URLClassPath {
/* Canonicalized File */ /* Canonicalized File */
private File dir; private File dir;
FileLoader(URL url) throws IOException { /*
* Creates a new FileLoader for the specified URL with a file protocol.
*/
private FileLoader(URL url) throws IOException {
super(url); super(url);
if (!"file".equals(url.getProtocol())) {
throw new IllegalArgumentException("url");
}
String path = url.getFile().replace('/', File.separatorChar); String path = url.getFile().replace('/', File.separatorChar);
path = ParseUtil.decode(path); path = ParseUtil.decode(path);
dir = (new File(path)).getCanonicalFile(); dir = (new File(path)).getCanonicalFile();