[jboss-cvs] JBossAS SVN: r114795 - 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:30:34 EDT 2014


Author: ehugonnet
Date: 2014-04-04 04:30:34 -0400 (Fri, 04 Apr 2014)
New Revision: 114795

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".


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-03 12:50:07 UTC (rev 114794)
+++ branches/JBPAPP_5/main/src/main/org/jboss/system/JBossRMIClassLoader.java	2014-04-04 08:30:34 UTC (rev 114795)
@@ -25,6 +25,10 @@
 
 import java.rmi.server.RMIClassLoader;
 import java.rmi.server.RMIClassLoaderSpi;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * An implementation of RMIClassLoaderSpi to workaround the
@@ -94,10 +98,28 @@
    /*
     * Just delegate
     */
-   public ClassLoader getClassLoader(String codebase)
+   public ClassLoader getClassLoader(final String codebase)
       throws MalformedURLException
    {
-      return delegate.getClassLoader(codebase);
+      if (System.getSecurityManager() == null) 
+      {
+          return delegate.getClassLoader(codebase);
+      }
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      {
+          @Override
+          public ClassLoader run()
+          {
+              try
+              {
+                  return delegate.getClassLoader(codebase);
+              }
+              catch (MalformedURLException ex)
+              {
+                  throw new RuntimeException(ex);
+              }
+          }
+      });
    }
 
    /*



More information about the jboss-cvs-commits mailing list