[jboss-remoting-commits] JBoss Remoting SVN: r3773 - remoting2/branches/2.x/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Mar 26 01:26:30 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-03-26 01:26:30 -0400 (Wed, 26 Mar 2008)
New Revision: 3773

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
Log:
JBREM-934: Put Class.getMethod() in AccessController.doPrivileged() calls.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java	2008-03-26 05:06:06 UTC (rev 3772)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java	2008-03-26 05:26:30 UTC (rev 3773)
@@ -32,6 +32,9 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -415,7 +418,24 @@
       if(transportFactoryClass != null)
       {
          ClientFactory transportFactory = (ClientFactory)transportFactoryClass.newInstance();
-         Method getClientInvokerMethod = transportFactoryClass.getMethod("createClientInvoker", new Class[] {InvokerLocator.class, Map.class});
+         Method getClientInvokerMethod = null;
+        
+         try
+         {
+            final Class finalClass = transportFactoryClass;
+            getClientInvokerMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return finalClass.getMethod("createClientInvoker", new Class[] {InvokerLocator.class, Map.class});
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw (Exception) e.getCause();
+         }
+         
          clientInvoker = (ClientInvoker)getClientInvokerMethod.invoke(transportFactory, new Object[] {locator, configuration});
       }
       else
@@ -434,8 +454,25 @@
       if(transportFactoryClass != null)
       {
          ServerFactory transportFactory = (ServerFactory)transportFactoryClass.newInstance();
-         Method getClientInvokerMethod = transportFactoryClass.getMethod("createServerInvoker", new Class[] {InvokerLocator.class, Map.class});
-         serverInvoker = (ServerInvoker)getClientInvokerMethod.invoke(transportFactory, new Object[] {locator, configuration});
+         Method getServerInvokerMethod = null;
+        
+         try
+         {
+            final Class finalClass = transportFactoryClass;
+            getServerInvokerMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return finalClass.getMethod("createServerInvoker", new Class[] {InvokerLocator.class, Map.class});
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw (Exception) e.getCause();
+         }
+         
+         serverInvoker = (ServerInvoker)getServerInvokerMethod.invoke(transportFactory, new Object[] {locator, configuration});
       }
       else
       {
@@ -636,7 +673,24 @@
       {
          transportFactoryClass = getTransportClientFactory(transport);
          ClientFactory clientFactory = (ClientFactory)transportFactoryClass.newInstance();
-         Method meth = transportFactoryClass.getMethod("supportsSSL", new Class[]{});
+         Method meth = null;
+         
+         try
+         {
+            final Class finalClass = transportFactoryClass;
+            meth = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return finalClass.getMethod("supportsSSL", new Class[]{});
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+            throw (Exception) e.getCause();
+         }
+         
          Boolean boolVal = (Boolean)meth.invoke(clientFactory, null);
          isSSLSupported = boolVal.booleanValue();
       }




More information about the jboss-remoting-commits mailing list