[jboss-cvs] JBossAS SVN: r114796 - branches/JBPAPP_5/main/src/main/org/jboss/system.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 4 04:45:37 EDT 2014


Author: ehugonnet
Date: 2014-04-04 04:45:36 -0400 (Fri, 04 Apr 2014)
New Revision: 114796

Modified:
   branches/JBPAPP_5/main/src/main/org/jboss/system/JBossRMIClassLoader.java
Log:
[JBPAPP-10904] Using doPriviledged to access the ClassLoader this fixing the "access denied".
reverting previous commit as the doPriviledged block was wrongly placed.



Modified: branches/JBPAPP_5/main/src/main/org/jboss/system/JBossRMIClassLoader.java
===================================================================
--- branches/JBPAPP_5/main/src/main/org/jboss/system/JBossRMIClassLoader.java	2014-04-04 08:30:34 UTC (rev 114795)
+++ branches/JBPAPP_5/main/src/main/org/jboss/system/JBossRMIClassLoader.java	2014-04-04 08:45:36 UTC (rev 114796)
@@ -83,7 +83,7 @@
    public Class<?> loadProxyClass(String codebase, String[] interfaces, ClassLoader ignored)
       throws MalformedURLException, ClassNotFoundException
    {
-      return delegate.loadProxyClass(codebase, interfaces, Thread.currentThread().getContextClassLoader());
+      return delegate.loadProxyClass(codebase, interfaces, getTTCLClassLoader());
    }
 
    /*
@@ -92,37 +92,36 @@
    public Class<?> loadClass(String codebase, String name, ClassLoader ignored)
       throws MalformedURLException, ClassNotFoundException
    {
-      return delegate.loadClass(codebase, name, Thread.currentThread().getContextClassLoader());
+      return delegate.loadClass(codebase, name, getTTCLClassLoader());
    }
 
-   /*
-    * Just delegate
-    */
-   public ClassLoader getClassLoader(final String codebase)
-      throws MalformedURLException
+   private ClassLoader getTTCLClassLoader()
    {
-      if (System.getSecurityManager() == null) 
+       if (System.getSecurityManager() == null)
       {
-          return delegate.getClassLoader(codebase);
+          return Thread.currentThread().getContextClassLoader();
       }
       return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
       {
           @Override
           public ClassLoader run()
           {
-              try
-              {
-                  return delegate.getClassLoader(codebase);
-              }
-              catch (MalformedURLException ex)
-              {
-                  throw new RuntimeException(ex);
-              }
+              return Thread.currentThread().getContextClassLoader();
           }
       });
    }
 
    /*
+    * Just delegate
+    */
+   public ClassLoader getClassLoader(final String codebase)
+      throws MalformedURLException
+   {
+
+      return delegate.getClassLoader(codebase);
+   }
+
+   /*
     * Try to delegate an default to the java.rmi.server.codebase on any
     * failure.
     */



More information about the jboss-cvs-commits mailing list