changeset 56037:40006c0ada91

8139820: URLClassPath.FileLoader constructor redundantly checks protocol Reviewed-by: chegar, redestad
author godin
date Wed, 21 Aug 2019 00:08:35 +0200
parents c83245fe66b3
children 182f94955cfb
files src/java.base/share/classes/jdk/internal/loader/URLClassPath.java
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Tue Aug 20 11:36:47 2019 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Wed Aug 21 00:08:35 2019 +0200
@@ -699,7 +699,7 @@
     /*
      * 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 final URL csu;
         private JarIndex index;
@@ -714,9 +714,9 @@
          * Creates a new JarLoader for the specified URL referring to
          * a JAR file.
          */
-        JarLoader(URL url, URLStreamHandler jarHandler,
-                  HashMap<String, Loader> loaderMap,
-                  AccessControlContext acc)
+        private JarLoader(URL url, URLStreamHandler jarHandler,
+                          HashMap<String, Loader> loaderMap,
+                          AccessControlContext acc)
             throws IOException
         {
             super(new URL("jar", "", -1, url + "!/", jarHandler));
@@ -1193,11 +1193,11 @@
         /* Canonicalized File */
         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);
-            if (!"file".equals(url.getProtocol())) {
-                throw new IllegalArgumentException("url");
-            }
             String path = url.getFile().replace('/', File.separatorChar);
             path = ParseUtil.decode(path);
             dir = (new File(path)).getCanonicalFile();