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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri May 9 03:54:39 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-05-09 03:54:39 -0400 (Fri, 09 May 2008)
New Revision: 4154

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
Log:
JBREM-977: Added two variations on createServerSocket().

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java	2008-05-09 07:52:49 UTC (rev 4153)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java	2008-05-09 07:54:39 UTC (rev 4154)
@@ -854,6 +854,30 @@
    }
    
    
+   static public ServerSocket createServerSocket(final ServerSocketFactoryMBean ssf) throws IOException
+   {
+      if (skipAccessControl)
+      {
+         return ssf.createServerSocket();
+      }
+
+      try
+      {
+         return (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws IOException
+            {
+               return ssf.createServerSocket();
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (IOException) e.getCause();
+      }
+   }
+   
+   
    static public ServerSocket createServerSocket(final ServerSocketFactoryMBean ssf,
                                                  final int port) throws IOException
    {
@@ -931,7 +955,31 @@
       }
    }
 
+   
+   static public ServerSocket createServerSocket(final ServerSocketFactory ssf) throws IOException
+   {
+      if (skipAccessControl)
+      {
+         return ssf.createServerSocket();
+      }
 
+      try
+      {
+         return (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws IOException
+            {
+               return ssf.createServerSocket();
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (IOException) e.getCause();
+      }
+   }
+   
+   
    static public ServerSocket createServerSocket(final ServerSocketFactory ssf,
                                                  final int port) throws IOException
    {
@@ -1008,8 +1056,8 @@
          throw (IOException) e.getCause();
       }
    }
-
    
+   
    static public ServerSocket createServerSocket(final int port) throws IOException
    {
       if (skipAccessControl)
@@ -1021,7 +1069,7 @@
       {
          return (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
          {
-            public Object run() throws Exception
+            public Object run() throws IOException
             {
                return new ServerSocket(port);
             }
@@ -1046,7 +1094,7 @@
       {
          return (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
          {
-            public Object run() throws Exception
+            public Object run() throws IOException
             {
                return new ServerSocket(port, backlog);
             }
@@ -1072,7 +1120,7 @@
       {
          return (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
          {
-            public Object run() throws Exception
+            public Object run() throws IOException
             {
                return new ServerSocket(port, backlog, inetAddress);
             }
@@ -1096,7 +1144,7 @@
       {
           return (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
           {
-             public Object run() throws Exception
+             public Object run() throws IOException
              {
                 return new Socket(host, port);
              }
@@ -1121,7 +1169,7 @@
       {
           return (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
           {
-             public Object run() throws Exception
+             public Object run() throws IOException
              {
                 return sf.createSocket(host, port);
              }




More information about the jboss-remoting-commits mailing list