mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8198481: Coding style cleanups for src/java.base/share/classes/jdk/internal/loader
Reviewed-by: alanb, mchung, rriggs
This commit is contained in:
parent
749ad1ee03
commit
8f24dc87b1
5 changed files with 28 additions and 29 deletions
|
@ -67,7 +67,7 @@ public class BootLoader {
|
||||||
// ServiceCatalog for the boot class loader
|
// ServiceCatalog for the boot class loader
|
||||||
private static final ServicesCatalog SERVICES_CATALOG = ServicesCatalog.create();
|
private static final ServicesCatalog SERVICES_CATALOG = ServicesCatalog.create();
|
||||||
|
|
||||||
// ClassLoaderValue map for boot class loader
|
// ClassLoaderValue map for the boot class loader
|
||||||
private static final ConcurrentHashMap<?, ?> CLASS_LOADER_VALUE_MAP
|
private static final ConcurrentHashMap<?, ?> CLASS_LOADER_VALUE_MAP
|
||||||
= new ConcurrentHashMap<>();
|
= new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class BuiltinClassLoader
|
||||||
// parent ClassLoader
|
// parent ClassLoader
|
||||||
private final BuiltinClassLoader parent;
|
private final BuiltinClassLoader parent;
|
||||||
|
|
||||||
// the URL class path or null if there is no class path
|
// the URL class path, or null if there is no class path
|
||||||
private final URLClassPath ucp;
|
private final URLClassPath ucp;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ import java.util.stream.Stream;
|
||||||
import jdk.internal.misc.SharedSecrets;
|
import jdk.internal.misc.SharedSecrets;
|
||||||
import jdk.internal.module.Resources;
|
import jdk.internal.module.Resources;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class loader that loads classes and resources from a collection of
|
* A class loader that loads classes and resources from a collection of
|
||||||
* modules, or from a single module where the class loader is a member
|
* modules, or from a single module where the class loader is a member
|
||||||
|
@ -111,7 +110,7 @@ public final class Loader extends SecureClassLoader {
|
||||||
private final Map<ModuleReference, ModuleReader> moduleToReader
|
private final Map<ModuleReference, ModuleReader> moduleToReader
|
||||||
= new ConcurrentHashMap<>();
|
= new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// ACC used when loading classes and resources */
|
// ACC used when loading classes and resources
|
||||||
private final AccessControlContext acc;
|
private final AccessControlContext acc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -83,4 +83,3 @@ public final class LoaderPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ import java.security.AccessControlException;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.CodeSigner;
|
import java.security.CodeSigner;
|
||||||
import java.security.Permission;
|
import java.security.Permission;
|
||||||
|
import java.security.PrivilegedActionException;
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -272,7 +273,7 @@ public class URLClassPath {
|
||||||
*
|
*
|
||||||
* @param name the name of the resource
|
* @param name the name of the resource
|
||||||
* @param check whether to perform a security check
|
* @param check whether to perform a security check
|
||||||
* @return a <code>URL</code> for the resource, or <code>null</code>
|
* @return a {@code URL} for the resource, or {@code null}
|
||||||
* if the resource could not be found.
|
* if the resource could not be found.
|
||||||
*/
|
*/
|
||||||
public URL findResource(String name, boolean check) {
|
public URL findResource(String name, boolean check) {
|
||||||
|
@ -465,8 +466,8 @@ public class URLClassPath {
|
||||||
*/
|
*/
|
||||||
private Loader getLoader(final URL url) throws IOException {
|
private Loader getLoader(final URL url) throws IOException {
|
||||||
try {
|
try {
|
||||||
return java.security.AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Loader run() throws IOException {
|
public Loader run() throws IOException {
|
||||||
String protocol = url.getProtocol(); // lower cased in URL
|
String protocol = url.getProtocol(); // lower cased in URL
|
||||||
String file = url.getFile();
|
String file = url.getFile();
|
||||||
|
@ -487,7 +488,7 @@ public class URLClassPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, acc);
|
}, acc);
|
||||||
} catch (java.security.PrivilegedActionException pae) {
|
} catch (PrivilegedActionException pae) {
|
||||||
throw (IOException)pae.getException();
|
throw (IOException)pae.getException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,8 +513,8 @@ public class URLClassPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether the resource URL should be returned.
|
* Checks whether the resource URL should be returned.
|
||||||
* Return null on security check failure.
|
* Returns null on security check failure.
|
||||||
* Called by java.net.URLClassLoader.
|
* Called by java.net.URLClassLoader.
|
||||||
*/
|
*/
|
||||||
public static URL checkURL(URL url) {
|
public static URL checkURL(URL url) {
|
||||||
|
@ -528,8 +529,8 @@ public class URLClassPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether the resource URL should be returned.
|
* Checks whether the resource URL should be returned.
|
||||||
* Throw exception on failure.
|
* Throws exception on failure.
|
||||||
* Called internally within this file.
|
* Called internally within this file.
|
||||||
*/
|
*/
|
||||||
public static void check(URL url) throws IOException {
|
public static void check(URL url) throws IOException {
|
||||||
|
@ -668,8 +669,8 @@ public class URLClassPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* close this loader and release all resources
|
* Closes this loader and release all resources.
|
||||||
* method overridden in sub-classes
|
* Method overridden in sub-classes.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
@ -740,8 +741,8 @@ public class URLClassPath {
|
||||||
private void ensureOpen() throws IOException {
|
private void ensureOpen() throws IOException {
|
||||||
if (jar == null) {
|
if (jar == null) {
|
||||||
try {
|
try {
|
||||||
java.security.AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws IOException {
|
public Void run() throws IOException {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
System.err.println("Opening " + csu);
|
System.err.println("Opening " + csu);
|
||||||
|
@ -773,7 +774,7 @@ public class URLClassPath {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, acc);
|
}, acc);
|
||||||
} catch (java.security.PrivilegedActionException pae) {
|
} catch (PrivilegedActionException pae) {
|
||||||
throw (IOException)pae.getException();
|
throw (IOException)pae.getException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -933,7 +934,7 @@ public class URLClassPath {
|
||||||
* visited by linking through the index files. This helper method uses
|
* visited by linking through the index files. This helper method uses
|
||||||
* a HashSet to store the URLs of jar files that have been searched and
|
* a HashSet to store the URLs of jar files that have been searched and
|
||||||
* uses it to avoid going into an infinite loop, looking for a
|
* uses it to avoid going into an infinite loop, looking for a
|
||||||
* non-existent resource
|
* non-existent resource.
|
||||||
*/
|
*/
|
||||||
Resource getResource(final String name, boolean check,
|
Resource getResource(final String name, boolean check,
|
||||||
Set<String> visited) {
|
Set<String> visited) {
|
||||||
|
@ -986,7 +987,7 @@ public class URLClassPath {
|
||||||
/* put it in the global hashtable */
|
/* put it in the global hashtable */
|
||||||
lmap.put(urlNoFragString, newLoader);
|
lmap.put(urlNoFragString, newLoader);
|
||||||
}
|
}
|
||||||
} catch (java.security.PrivilegedActionException pae) {
|
} catch (PrivilegedActionException pae) {
|
||||||
continue;
|
continue;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue