[jboss-cvs] JBossAS SVN: r103061 - projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 26 14:43:33 EDT 2010


Author: alesj
Date: 2010-03-26 14:43:32 -0400 (Fri, 26 Mar 2010)
New Revision: 103061

Modified:
   projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DirectRootResourceOwnerFinder.java
Log:
Use priv block

Modified: projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DirectRootResourceOwnerFinder.java
===================================================================
--- projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DirectRootResourceOwnerFinder.java	2010-03-26 18:26:28 UTC (rev 103060)
+++ projects/scanning/trunk/scanning-impl/src/main/java/org/jboss/scanning/plugins/helpers/DirectRootResourceOwnerFinder.java	2010-03-26 18:43:32 UTC (rev 103061)
@@ -24,6 +24,8 @@
 
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
 
 import org.jboss.classloading.plugins.vfs.VFSResourceVisitor;
 import org.jboss.classloading.spi.visitor.ResourceContext;
@@ -43,8 +45,18 @@
    {
       try
       {
-         Class<?> clazz = VFSResourceVisitor.class;
-         currentRootGetter = clazz.getDeclaredMethod("getCurrentRoot");
+         final Class<?> clazz = VFSResourceVisitor.class;
+         SecurityManager sm = System.getSecurityManager();
+         if (sm == null)
+            currentRootGetter = clazz.getDeclaredMethod("getCurrentRoot");
+         else
+            currentRootGetter = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>()
+            {
+               public Method run() throws Exception
+               {
+                  return clazz.getDeclaredMethod("getCurrentRoot");
+               }
+            });
       }
       catch (Throwable ignored)
       {




More information about the jboss-cvs-commits mailing list