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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Mar 20 21:32:33 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-03-20 21:32:33 -0400 (Thu, 20 Mar 2008)
New Revision: 3700

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java
Log:
JBREM-934: Put ServerSocket.accept() in AccessController.doPrivileged() call.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java	2008-03-21 01:31:59 UTC (rev 3699)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java	2008-03-21 01:32:33 UTC (rev 3700)
@@ -28,6 +28,9 @@
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.nio.channels.ServerSocketChannel;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
 /** 
  * A CreationListenerServerSocket wraps a ServerSocket to which it delegates
@@ -91,8 +94,23 @@
    
    
    public Socket accept() throws IOException
-   {
-      Socket socket = serverSocket.accept();
+   {  
+      Socket socket = null;
+      try
+      {
+          socket = (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+          {
+             public Object run() throws Exception
+             {
+                 return serverSocket.accept();
+             }
+          });
+      }
+      catch (PrivilegedActionException e)
+      {
+          throw (IOException) e.getCause();
+      }
+      
       listener.socketCreated(socket, serverSocket);
       return socket;
    }




More information about the jboss-remoting-commits mailing list