Index: DefaultRMIClassLoaderSpi.java =================================================================== --- DefaultRMIClassLoaderSpi.java (revision 467245) +++ DefaultRMIClassLoaderSpi.java (working copy) @@ -421,7 +421,7 @@ /* * Finds loader in classloaders table. Returns it as a result if it's not * null, otherwise creates URLLoader, adds it to the table and returns it - * as a result. + * as a result. Checks persmission on found/created loader. * * @param codebase list of URLs separated by spaces * @@ -447,6 +447,30 @@ return parentLoader; } } + URLLoader loader = getClassLoaderNoCheck(parentLoader, codebase); + + if (loader != null) { + loader.checkPermissions(); + } + return loader; + } + + /* + * Finds URLLoader in classloaders table. Returns it as a result if it's not + * null, otherwise creates URLLoader, adds it to the table and returns it + * as a result. Does not check persmission on found/created loader. + * + * @param parentLoader parent classloader + * @param codebase list of URLs separated by spaces + * + * @return URLLoader found/created + * + * @throws MalformedURLException if the method was unable to parse one of + * provided URLs + */ + private static URLLoader getClassLoaderNoCheck( + ClassLoader parentLoader, + String codebase) throws MalformedURLException { TableKey key = new TableKey(parentLoader, codebase); URLLoader loader = null; @@ -457,9 +481,6 @@ if (loader == null) { urlLoaders.remove(key); } else { - if (loader != null) { - loader.checkPermissions(); - } return loader; } } @@ -482,12 +503,8 @@ loader = AccessController.doPrivileged( new CreateLoaderAction(key.getURLs(), parentLoader), ctx); urlLoaders.put(key, new WeakReference(loader)); + return loader; } - - if (loader != null) { - loader.checkPermissions(); - } - return loader; } /*