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

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


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

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

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java	2008-03-26 05:26:59 UTC (rev 3774)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java	2008-03-26 05:27:26 UTC (rev 3775)
@@ -52,6 +52,9 @@
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -111,13 +114,28 @@
       boolean apr = false;
       try
       {
-         String methodName = "initialize";
-         Class paramTypes[] = new Class[1];
+         final String methodName = "initialize";
+         final Class paramTypes[] = new Class[1];
          paramTypes[0] = String.class;
          Object paramValues[] = new Object[1];
          paramValues[0] = null;
-         Method method = Class.forName("org.apache.tomcat.jni.Library")
-               .getMethod(methodName, paramTypes);
+         Method method = null;
+         
+         try
+         {
+            method = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return Class.forName("org.apache.tomcat.jni.Library").getMethod(methodName, paramTypes);
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+             throw (Exception) e.getCause();
+         }
+         
          method.invoke(null, paramValues);
          apr = true;
       }




More information about the jboss-remoting-commits mailing list