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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:18:41 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-11 21:18:41 -0400 (Fri, 11 Apr 2008)
New Revision: 3951

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

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-04-12 01:14:44 UTC (rev 3950)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-04-12 01:18:41 UTC (rev 3951)
@@ -32,6 +32,7 @@
 import org.jboss.remoting.marshal.MarshalFactory;
 import org.jboss.remoting.marshal.MarshallLoaderFactory;
 import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.remoting.util.SecurityUtility;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -565,22 +566,7 @@
                String serverBindPort = (String) invokerConfig.get("serverBindPort");
                String path = (String) invokerConfig.get("path");
 
-               String localHostAddress = null;
-               try
-               {
-                  localHostAddress = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                  {
-                     public Object run() throws UnknownHostException
-                     {
-                        return InetAddress.getLocalHost().getHostAddress();
-                     }
-                  });
-               }
-               catch (PrivilegedActionException e)
-               {
-                  throw (UnknownHostException) e.getCause();
-               }
-               
+               String localHostAddress = SecurityUtility.getLocalHost().getHostAddress();              
                String host = clientConnectAddress != null ? clientConnectAddress : serverBindAddress != null ? serverBindAddress : localHostAddress;
                int port = clientConnectPort != null ? Integer.parseInt(clientConnectPort) : serverBindPort != null ? Integer.parseInt(serverBindPort) : PortUtil.findFreePort(serverBindAddress != null ? serverBindAddress : localHostAddress);
 
@@ -706,21 +692,7 @@
          boolean parametersStarted = false;
          if (connectHomes == null && homes == null)
          {
-            String localHostAddress = null;
-            try
-            {
-               localHostAddress = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
-               {
-                  public Object run() throws UnknownHostException
-                  {
-                     return InetAddress.getLocalHost().getHostAddress();
-                  }
-               });
-            }
-            catch (PrivilegedActionException e)
-            {
-               throw (UnknownHostException) e.getCause();
-            }
+            String localHostAddress = SecurityUtility.getLocalHost().getHostAddress();
             
             // A single home configuration.
             String host = clientConnectAddress != null 
@@ -1021,22 +993,8 @@
             {
                try
                {
-                  final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
-                  try
-                  {
-                     AccessController.doPrivileged( new PrivilegedExceptionAction()
-                     {
-                        public Object run() throws Exception
-                        {
-                           server.unregisterMBean(objName);
-                           return null;
-                        }
-                     });
-                  }
-                  catch (PrivilegedActionException e)
-                  {
-                     throw (Exception) e.getCause();
-                  }
+                  ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+                  SecurityUtility.unregisterMBean(server, objName);
                }
                catch (Exception e)
                {




More information about the jboss-remoting-commits mailing list