Author: ron.sigal(a)jboss.com
Date: 2009-04-14 06:18:15 -0400 (Tue, 14 Apr 2009)
New Revision: 5010
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java
Log:
JBREM-1116: Eliminated dependence on SecurityUtility.
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 2009-04-14
10:17:57 UTC (rev 5009)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/CreationListenerServerSocket.java 2009-04-14
10:18:15 UTC (rev 5010)
@@ -94,13 +94,13 @@
public void bind(SocketAddress endpoint) throws IOException
{
- SecurityUtility.bind(serverSocket, endpoint);
+ bind(serverSocket, endpoint);
}
public void bind(SocketAddress endpoint, int backlog) throws IOException
{
- SecurityUtility.bind(serverSocket, endpoint, backlog);
+ bind(serverSocket, endpoint, backlog);
}
@@ -223,4 +223,56 @@
{
return serverSocket.toString();
}
+
+ static private void bind(final ServerSocket ss, final SocketAddress address)
+ throws IOException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ ss.bind(address);
+ return;
+ }
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ ss.bind(address);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ }
+
+ static private void bind(final ServerSocket ss, final SocketAddress address,
+ final int backlog) throws IOException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ ss.bind(address, backlog);
+ return;
+ }
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ ss.bind(address, backlog);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ }
}
Show replies by date