Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:52:18 -0400 (Fri, 11 Apr 2008)
New Revision: 3930
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() with SecurityUtility.getMethod().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java 2008-04-12
00:51:33 UTC (rev 3929)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java 2008-04-12
00:52:18 UTC (rev 3930)
@@ -29,6 +29,7 @@
import org.jboss.remoting.transport.ClientInvoker;
import org.jboss.remoting.transport.ServerFactory;
import org.jboss.remoting.transport.local.LocalClientInvoker;
+import org.jboss.remoting.util.SecurityUtility;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -418,24 +419,9 @@
if(transportFactoryClass != null)
{
ClientFactory transportFactory =
(ClientFactory)transportFactoryClass.newInstance();
- 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();
- }
-
+ Method getClientInvokerMethod =
SecurityUtility.getMethod(transportFactoryClass,
+
"createClientInvoker",
+ new Class[]
{InvokerLocator.class, Map.class});
clientInvoker = (ClientInvoker)getClientInvokerMethod.invoke(transportFactory,
new Object[] {locator, configuration});
}
else
@@ -454,24 +440,9 @@
if(transportFactoryClass != null)
{
ServerFactory transportFactory =
(ServerFactory)transportFactoryClass.newInstance();
- 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();
- }
-
+ Method getServerInvokerMethod =
SecurityUtility.getMethod(transportFactoryClass,
+
"createServerInvoker",
+ new Class[]
{InvokerLocator.class, Map.class});
serverInvoker = (ServerInvoker)getServerInvokerMethod.invoke(transportFactory,
new Object[] {locator, configuration});
}
else
@@ -673,24 +644,7 @@
{
transportFactoryClass = getTransportClientFactory(transport);
ClientFactory clientFactory =
(ClientFactory)transportFactoryClass.newInstance();
- 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();
- }
-
+ Method meth = SecurityUtility.getMethod(transportFactoryClass,
"supportsSSL", new Class[]{});
Boolean boolVal = (Boolean)meth.invoke(clientFactory, null);
isSSLSupported = boolVal.booleanValue();
}
Show replies by date