< prev index next >
src/java.base/share/classes/sun/misc/URLClassPath.java
Print this page
*** 95,114 ****
new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
}
/* The original search path of URLs. */
! private ArrayList<URL> path = new ArrayList<URL>();
/* The stack of unopened URLs */
! Stack<URL> urls = new Stack<URL>();
/* The resulting search path of Loaders */
! ArrayList<Loader> loaders = new ArrayList<Loader>();
/* Map of each URL opened to its corresponding Loader */
! HashMap<String, Loader> lmap = new HashMap<String, Loader>();
/* The jar protocol handler to use when creating new URLs */
private URLStreamHandler jarHandler;
/* Whether this URLClassLoader has been closed yet */
--- 95,114 ----
new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
}
/* The original search path of URLs. */
! private ArrayList<URL> path = new ArrayList<>();
/* The stack of unopened URLs */
! Stack<URL> urls = new Stack<>();
/* The resulting search path of Loaders */
! ArrayList<Loader> loaders = new ArrayList<>();
/* Map of each URL opened to its corresponding Loader */
! HashMap<String, Loader> lmap = new HashMap<>();
/* The jar protocol handler to use when creating new URLs */
private URLStreamHandler jarHandler;
/* Whether this URLClassLoader has been closed yet */
*** 140,150 ****
public synchronized List<IOException> closeLoaders() {
if (closed) {
return Collections.emptyList();
}
! List<IOException> result = new LinkedList<IOException>();
for (Loader loader : loaders) {
try {
loader.close();
} catch (IOException e) {
result.add (e);
--- 140,150 ----
public synchronized List<IOException> closeLoaders() {
if (closed) {
return Collections.emptyList();
}
! List<IOException> result = new LinkedList<>();
for (Loader loader : loaders) {
try {
loader.close();
} catch (IOException e) {
result.add (e);
*** 232,242 ****
* @param name the resource name
* @return an Enumeration of all the urls having the specified name
*/
public Enumeration<URL> findResources(final String name,
final boolean check) {
! return new Enumeration<URL>() {
private int index = 0;
private URL url = null;
private boolean next() {
if (url != null) {
--- 232,242 ----
* @param name the resource name
* @return an Enumeration of all the urls having the specified name
*/
public Enumeration<URL> findResources(final String name,
final boolean check) {
! return new Enumeration<>() {
private int index = 0;
private URL url = null;
private boolean next() {
if (url != null) {
*** 279,289 ****
* @param name the resource name
* @return an Enumeration of all the resources having the specified name
*/
public Enumeration<Resource> getResources(final String name,
final boolean check) {
! return new Enumeration<Resource>() {
private int index = 0;
private Resource res = null;
private boolean next() {
if (res != null) {
--- 279,289 ----
* @param name the resource name
* @return an Enumeration of all the resources having the specified name
*/
public Enumeration<Resource> getResources(final String name,
final boolean check) {
! return new Enumeration<>() {
private int index = 0;
private Resource res = null;
private boolean next() {
if (res != null) {
*** 372,382 ****
* Returns the Loader for the specified base URL.
*/
private Loader getLoader(final URL url) throws IOException {
try {
return java.security.AccessController.doPrivileged(
! new java.security.PrivilegedExceptionAction<Loader>() {
public Loader run() throws IOException {
String file = url.getFile();
if (file != null && file.endsWith("/")) {
if ("file".equals(url.getProtocol())) {
return new FileLoader(url);
--- 372,382 ----
* Returns the Loader for the specified base URL.
*/
private Loader getLoader(final URL url) throws IOException {
try {
return java.security.AccessController.doPrivileged(
! new java.security.PrivilegedExceptionAction<>() {
public Loader run() throws IOException {
String file = url.getFile();
if (file != null && file.endsWith("/")) {
if ("file".equals(url.getProtocol())) {
return new FileLoader(url);
*** 687,697 ****
private void ensureOpen() throws IOException {
if (jar == null) {
try {
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedExceptionAction<Void>() {
public Void run() throws IOException {
if (DEBUG) {
System.err.println("Opening " + csu);
Thread.dumpStack();
}
--- 687,697 ----
private void ensureOpen() throws IOException {
if (jar == null) {
try {
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedExceptionAction<>() {
public Void run() throws IOException {
if (DEBUG) {
System.err.println("Opening " + csu);
Thread.dumpStack();
}
*** 868,878 ****
return checkResource(name, check, entry);
if (index == null)
return null;
! HashSet<String> visited = new HashSet<String>();
return getResource(name, check, visited);
}
/*
* Version of getResource() that tracks the jar files that have been
--- 868,878 ----
return checkResource(name, check, entry);
if (index == null)
return null;
! HashSet<String> visited = new HashSet<>();
return getResource(name, check, visited);
}
/*
* Version of getResource() that tracks the jar files that have been
*** 910,920 ****
if ((newLoader = (JarLoader)lmap.get(urlNoFragString)) == null) {
/* no loader has been set up for this jar file
* before
*/
newLoader = AccessController.doPrivileged(
! new PrivilegedExceptionAction<JarLoader>() {
public JarLoader run() throws IOException {
return new JarLoader(url, handler,
lmap);
}
});
--- 910,920 ----
if ((newLoader = (JarLoader)lmap.get(urlNoFragString)) == null) {
/* no loader has been set up for this jar file
* before
*/
newLoader = AccessController.doPrivileged(
! new PrivilegedExceptionAction<>() {
public JarLoader run() throws IOException {
return new JarLoader(url, handler,
lmap);
}
});
< prev index next >