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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:25:44 EDT 2008


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

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

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java	2008-04-12 01:23:22 UTC (rev 3956)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java	2008-04-12 01:25:44 UTC (rev 3957)
@@ -42,6 +42,7 @@
 import org.jboss.remoting.InvokerLocator;
 import org.jboss.remoting.Remoting;
 import org.jboss.remoting.Version;
+import org.jboss.remoting.util.SecurityUtility;
 
 
 /**
@@ -197,51 +198,20 @@
                log.warn("unable to retrieve socket factory: returning plain socket");
             }
          
-            Socket socket = null;
-            try
-            {
-                socket = (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
-                {
-                   public Object run() throws Exception
-                   {
-                      return new Socket(effectiveHost, port);
-                   }
-                });
-            }
-            catch (PrivilegedActionException e)
-            {
-               throw (IOException) e.getCause();
-            }
-            return socket;
+            return SecurityUtility.createSocket(effectiveHost, port);
          }
          
          socketFactory = retrieveSocketFactory(holder);
       }
 
       Socket socket = null;
-      
-      try
+      if(socketFactory != null)
       {
-         socket = (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
-         {
-            public Object run() throws Exception
-            {
-               Socket s = null;
-               if(socketFactory != null)
-               {
-                  s = socketFactory.createSocket(effectiveHost, port);
-               }
-               else
-               {
-                  s = new Socket(effectiveHost, port);
-               }
-               return s;
-            }
-         });
+         socket = SecurityUtility.createSocket(socketFactory, effectiveHost, port);
       }
-      catch (PrivilegedActionException e)
+      else
       {
-         throw (IOException) e.getCause();
+         socket = SecurityUtility.createSocket(effectiveHost, port);
       }
 
       socket.setSoTimeout(timeout);
@@ -302,21 +272,8 @@
          protocol = invokerLocator.getProtocol().toLowerCase();
          
          try
-         {
-            try
-            {
-               host = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
-               {
-                  public Object run() throws UnknownHostException
-                  {
-                     return InetAddress.getByName(invokerLocator.getHost());
-                  }
-               });
-            }
-            catch (PrivilegedActionException e)
-            {
-               throw (UnknownHostException) e.getCause();
-            }  
+         { 
+            host = SecurityUtility.getAddressByName(invokerLocator.getHost());
          }
          catch (UnknownHostException e)
          {




More information about the jboss-remoting-commits mailing list