[jboss-remoting-commits] JBoss Remoting SVN: r3952 - 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
Fri Apr 11 21:19:44 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-11 21:19:44 -0400 (Fri, 11 Apr 2008)
New Revision: 3952

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..

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-04-12 01:18:41 UTC (rev 3951)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java	2008-04-12 01:19:44 UTC (rev 3952)
@@ -45,6 +45,7 @@
 import org.jboss.remoting.transport.http.HTTPMetadataConstants;
 import org.jboss.remoting.transport.web.WebServerInvoker;
 import org.jboss.remoting.transport.web.WebUtil;
+import org.jboss.remoting.util.SecurityUtility;
 import org.jboss.logging.Logger;
 
 import javax.net.ServerSocketFactory;
@@ -162,19 +163,11 @@
       Class clazz = null;
       try
       {
-         // The class initialization refers to a System property for logging.
-         final String finalClassName = protocolHandlerClassName;
-         clazz = (Class) AccessController.doPrivileged( new PrivilegedExceptionAction()
-         {
-            public Object run() throws Exception
-            {
-               return Class.forName(finalClassName);
-            }
-         });
+         clazz = (Class) SecurityUtility.forName(protocolHandlerClassName);
       }
-      catch (PrivilegedActionException e)
+      catch (ClassNotFoundException e)
       {
-         log.error("Protocol handler class instatiation failed: protocolHandlerClassName", e.getCause());
+         log.error("Protocol handler class instatiation failed: protocolHandlerClassName", e);
          return;
       }
       
@@ -355,22 +348,8 @@
             MessageBytes remoteAddressMB = req.remoteAddr();
             if (remoteAddressMB != null)
             {
-               final String remoteAddressString = remoteAddressMB.toString();
-               InetAddress remoteAddress = null;
-               try
-               {
-                  remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                  {
-                     public Object run() throws UnknownHostException
-                     {
-                        return InetAddress.getByName(remoteAddressString);
-                     }
-                  });
-               }
-               catch (PrivilegedActionException e)
-               {
-                  throw (UnknownHostException) e.getCause();
-               }
+               String remoteAddressString = remoteAddressMB.toString();
+               InetAddress remoteAddress = SecurityUtility.getAddressByName(remoteAddressString);
                invocationRequest.getRequestPayload().put(Remoting.CLIENT_ADDRESS, remoteAddress);  
             }
             else
@@ -1061,25 +1040,11 @@
 
                   // Try a setFoo ( InetAddress )
                }
-               else if("java.net.InetAddress".equals(paramType
-                     .getName()))
+               else if("java.net.InetAddress".equals(paramType.getName()))
                {
                   try
                   {
-                     try
-                     {
-                        params[0] = AccessController.doPrivileged( new PrivilegedExceptionAction()
-                        {
-                           public Object run() throws UnknownHostException
-                           {
-                              return InetAddress.getByName(value);
-                           }
-                        });
-                     }
-                     catch (PrivilegedActionException e)
-                     {
-                        throw (UnknownHostException) e.getCause();
-                     }
+                     params[0] = SecurityUtility.getAddressByName(value);
                   }
                   catch(UnknownHostException exc)
                   {




More information about the jboss-remoting-commits mailing list