--- old/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java 2019-01-04 10:01:55.502538408 -0800 +++ new/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java 2019-01-04 10:01:55.186538670 -0800 @@ -326,8 +326,7 @@ * @param name the resource name * @return an Enumeration of all the urls having the specified name */ - public Enumeration findResources(final String name, - final boolean check) { + public Enumeration findResources(String name, boolean check) { return new Enumeration<>() { private int index = 0; private URL url = null; @@ -373,8 +372,7 @@ * @param name the resource name * @return an Enumeration of all the resources having the specified name */ - public Enumeration getResources(final String name, - final boolean check) { + public Enumeration getResources(String name, boolean check) { return new Enumeration<>() { private int index = 0; private Resource res = null; @@ -409,7 +407,7 @@ }; } - public Enumeration getResources(final String name) { + public Enumeration getResources(String name) { return getResources(name, true); } @@ -537,9 +535,8 @@ /* * Checks whether the resource URL should be returned. * Throws exception on failure. - * Called internally within this file. */ - public static void check(URL url) throws IOException { + private static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); @@ -571,8 +568,7 @@ } /** - * Nested class used to represent a loader of resources and classes - * from a base URL. + * A loader of resources and classes from a base URL. */ private static class Loader implements Closeable { private final URL base; @@ -670,7 +666,7 @@ * found or the caller does not have the permission to get the * resource. */ - Resource getResource(final String name) { + Resource getResource(String name) { return getResource(name, true); } @@ -694,7 +690,7 @@ } /* - * Nested class used to represent a Loader of resources from a JAR URL. + * A Loader of resources from a JAR URL. */ static class JarLoader extends Loader { private JarFile jar; @@ -726,7 +722,7 @@ } @Override - public void close () throws IOException { + public void close() throws IOException { // closing is synchronized at higher level if (!closed) { closed = true; @@ -736,7 +732,7 @@ } } - JarFile getJarFile () { + JarFile getJarFile() { return jar; } @@ -786,7 +782,7 @@ } } - /* Throws if the given jar file is does not start with the correct LOC */ + /* Throws if the given jar file does not start with the correct LOC */ static JarFile checkJar(JarFile jar) throws IOException { if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING && !zipAccess.startsWithLocHeader(jar)) { @@ -832,7 +828,7 @@ /* * Creates the resource and if the check flag is set to true, checks if - * is its okay to return the resource. + * is it's okay to return the resource. */ Resource checkResource(final String name, boolean check, final JarEntry entry) { @@ -905,7 +901,7 @@ } /* - * Returns the URL for a resource with the specified name + * Returns the URL for a resource with the specified name. */ @Override URL findResource(final String name, boolean check) { @@ -1036,8 +1032,7 @@ continue; } - /* Process the index of the new loader - */ + // Process the index of the new loader if ((res = newLoader.getResource(name, check, visited)) != null) { return res; @@ -1108,7 +1103,7 @@ } /* - * Return a URL for the given path resolved against the base URL, or + * Returns a URL for the given path resolved against the base URL, or * null if the resulting URL is invalid. */ static URL safeResolve(URL base, String path) { @@ -1140,8 +1135,7 @@ } /* - * Nested class used to represent a loader of classes and resources - * from a file URL that refers to a directory. + * A loader of classes and resources from a file URL that refers to a directory. */ private static class FileLoader extends Loader { /* Canonicalized File */ @@ -1158,10 +1152,10 @@ } /* - * Returns the URL for a resource with the specified name + * Returns the URL for a resource with the specified name. */ @Override - URL findResource(final String name, boolean check) { + URL findResource(String name, boolean check) { Resource rsc = getResource(name, check); if (rsc != null) { return rsc.getURL(); @@ -1170,13 +1164,13 @@ } @Override - Resource getResource(final String name, boolean check) { - final URL url; + Resource getResource(String name, boolean check) { try { URL normalizedBase = new URL(getBaseURL(), "."); - url = new URL(getBaseURL(), ParseUtil.encodePath(name, false)); + final URL url = new URL( + getBaseURL(), ParseUtil.encodePath(name, false)); - if (url.getFile().startsWith(normalizedBase.getFile()) == false) { + if (!url.getFile().startsWith(normalizedBase.getFile())) { // requested resource had ../..'s in path return null; } @@ -1188,7 +1182,7 @@ if (name.indexOf("..") != -1) { file = (new File(dir, name.replace('/', File.separatorChar))) .getCanonicalFile(); - if ( !((file.getPath()).startsWith(dir.getPath())) ) { + if (!file.getPath().startsWith(dir.getPath())) { /* outside of base dir */ return null; }