[jboss-remoting-commits] JBoss Remoting SVN: r3958 - 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:26:54 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-11 21:26:54 -0400 (Fri, 11 Apr 2008)
New Revision: 3958

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

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java	2008-04-12 01:25:44 UTC (rev 3957)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java	2008-04-12 01:26:54 UTC (rev 3958)
@@ -23,6 +23,8 @@
 package org.jboss.remoting.transport.rmi;
 
 import org.jboss.logging.Logger;
+import org.jboss.remoting.util.SecurityUtility;
+
 import javax.net.ServerSocketFactory;
 import java.io.IOException;
 import java.io.Serializable;
@@ -121,22 +123,7 @@
       this.serverSocketFactory = serverSocketFactory;
       this.backlog = backlog;
       this.timeout = timeout;
-      
-      try
-      {
-         AccessController.doPrivileged( new PrivilegedExceptionAction()
-         {
-            public Object run() throws UnknownHostException
-            {
-               RemotingRMIServerSocketFactory.this.bindAddress = InetAddress.getByName(bindHost);
-               return null;
-            }
-         });
-      }
-      catch (PrivilegedActionException e)
-      {
-         throw (UnknownHostException) e.getCause();
-      } 
+      this.bindAddress = SecurityUtility.getAddressByName(bindHost);
    }
 
    public RemotingRMIServerSocketFactory(String bindHost, int timeout) throws UnknownHostException
@@ -165,45 +152,29 @@
    {
       ServerSocket svrSocket = null;
 
-      try
+      if(serverSocketFactory != null)
       {
-         svrSocket = (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
-         {
-            public Object run() throws Exception
-            {
-               ServerSocket ss = null;
+         svrSocket = SecurityUtility.createServerSocket(serverSocketFactory, port, backlog, bindAddress);
+      }
 
-               if(serverSocketFactory != null)
-               {
-                  ss = serverSocketFactory.createServerSocket(port, backlog, bindAddress);
-               }
+//      if (constructor != null)
+//      {
+//         try
+//         {
+//            if (portPosition != -1)
+//               args[portPosition] = new Integer(port);
+//
+//            return (ServerSocket) constructor.newInstance(args);
+//         }
+//         catch (Exception e)
+//         {
+//            throw new IOException(e.getMessage());
+//         }
+//      }
 
-//                if (constructor != null)
-//                {
-//                   try
-//                   {
-//                      if (portPosition != -1)
-//                         args[portPosition] = new Integer(port);
-          //
-//                      return (ServerSocket) constructor.newInstance(args);
-//                   }
-//                   catch (Exception e)
-//                   {
-//                      throw new IOException(e.getMessage());
-//                   }
-//                }
-
-               else
-               {
-                  ss = new ServerSocket(port, backlog, bindAddress);
-               }
-               return ss;
-            }
-         });
-      }
-      catch (PrivilegedActionException e)
+      else
       {
-         throw (IOException) e.getCause();
+         svrSocket = SecurityUtility.createServerSocket(port, backlog, bindAddress);
       }
 
       svrSocket.setSoTimeout(timeout);




More information about the jboss-remoting-commits mailing list