< prev index next >

src/java.base/share/classes/java/net/URLClassLoader.java

Print this page

        

*** 357,367 **** throws ClassNotFoundException { final Class<?> result; try { result = AccessController.doPrivileged( ! new PrivilegedExceptionAction<Class<?>>() { public Class<?> run() throws ClassNotFoundException { String path = name.replace('.', '/').concat(".class"); Resource res = ucp.getResource(path, false); if (res != null) { try { --- 357,367 ---- throws ClassNotFoundException { final Class<?> result; try { result = AccessController.doPrivileged( ! new PrivilegedExceptionAction<>() { public Class<?> run() throws ClassNotFoundException { String path = name.replace('.', '/').concat(".class"); Resource res = ucp.getResource(path, false); if (res != null) { try {
*** 562,572 **** public URL findResource(final String name) { /* * The same restriction to finding classes applies to resources */ URL url = AccessController.doPrivileged( ! new PrivilegedAction<URL>() { public URL run() { return ucp.findResource(name, true); } }, acc); --- 562,572 ---- public URL findResource(final String name) { /* * The same restriction to finding classes applies to resources */ URL url = AccessController.doPrivileged( ! new PrivilegedAction<>() { public URL run() { return ucp.findResource(name, true); } }, acc);
*** 585,604 **** public Enumeration<URL> findResources(final String name) throws IOException { final Enumeration<URL> e = ucp.findResources(name, true); ! return new Enumeration<URL>() { private URL url = null; private boolean next() { if (url != null) { return true; } do { URL u = AccessController.doPrivileged( ! new PrivilegedAction<URL>() { public URL run() { if (!e.hasMoreElements()) return null; return e.nextElement(); } --- 585,604 ---- public Enumeration<URL> findResources(final String name) throws IOException { final Enumeration<URL> e = ucp.findResources(name, true); ! return new Enumeration<>() { private URL url = null; private boolean next() { if (url != null) { return true; } do { URL u = AccessController.doPrivileged( ! new PrivilegedAction<>() { public URL run() { if (!e.hasMoreElements()) return null; return e.nextElement(); }
*** 702,712 **** if (p != null) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { final Permission fp = p; ! AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() throws SecurityException { sm.checkPermission(fp); return null; } }, acc); --- 702,712 ---- if (p != null) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { final Permission fp = p; ! AccessController.doPrivileged(new PrivilegedAction<>() { public Void run() throws SecurityException { sm.checkPermission(fp); return null; } }, acc);
*** 733,743 **** final ClassLoader parent) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader URLClassLoader ucl = AccessController.doPrivileged( ! new PrivilegedAction<URLClassLoader>() { public URLClassLoader run() { return new FactoryURLClassLoader(urls, parent, acc); } }); return ucl; --- 733,743 ---- final ClassLoader parent) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader URLClassLoader ucl = AccessController.doPrivileged( ! new PrivilegedAction<>() { public URLClassLoader run() { return new FactoryURLClassLoader(urls, parent, acc); } }); return ucl;
*** 758,768 **** public static URLClassLoader newInstance(final URL[] urls) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader URLClassLoader ucl = AccessController.doPrivileged( ! new PrivilegedAction<URLClassLoader>() { public URLClassLoader run() { return new FactoryURLClassLoader(urls, acc); } }); return ucl; --- 758,768 ---- public static URLClassLoader newInstance(final URL[] urls) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader URLClassLoader ucl = AccessController.doPrivileged( ! new PrivilegedAction<>() { public URLClassLoader run() { return new FactoryURLClassLoader(urls, acc); } }); return ucl;
< prev index next >