[jboss-remoting-commits] JBoss Remoting SVN: r3962 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:42:21 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-11 21:42:21 -0400 (Fri, 11 Apr 2008)
New Revision: 3962
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2008-04-12 01:41:00 UTC (rev 3961)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2008-04-12 01:42:21 UTC (rev 3962)
@@ -11,6 +11,7 @@
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.Version;
import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
@@ -29,7 +30,6 @@
import java.net.Socket;
import java.net.InetSocketAddress;
import java.net.SocketException;
-import java.net.UnknownHostException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -506,20 +506,7 @@
if (!InvokerLocator.MULTIHOME.equals(locator.getHost()))
{
- try
- {
- addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(locator.getHost());
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ addr = SecurityUtility.getAddressByName(locator.getHost());
port = locator.getPort();
address = createServerAddress(addr, port);
}
@@ -529,22 +516,8 @@
if (homes.size() == 1)
{
// Treat as in non MULTIHOME case.
- final Home home = (Home) homes.iterator().next();
- try
- {
- addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(home.host);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
-
+ Home home = (Home) homes.iterator().next();
+ addr = SecurityUtility.getAddressByName(home.host);
address = createServerAddress(addr, home.port);
}
}
@@ -674,21 +647,7 @@
try
{
home = (Home) it.next();
- try
- {
- final Home finalHome = home;
- addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(finalHome.host);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ addr = SecurityUtility.getAddressByName(home.host);
address = createServerAddress(addr, home.port);
invoke(new InvocationRequest(null, null, ServerInvoker.ECHO, null, null, null));
if (trace) log.trace(this + " able to contact server at: " + home);
@@ -1162,26 +1121,10 @@
protected Socket createSocket(String address, int port, int timeout) throws IOException
{
- final Socket s = new Socket();
+ Socket s = new Socket();
configureSocket(s);
- final InetSocketAddress inetAddr = new InetSocketAddress(address, port);
-
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- s.connect(inetAddr);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
-
+ InetSocketAddress inetAddr = new InetSocketAddress(address, port);
+ SecurityUtility.connect(s, inetAddr);
return s;
}
More information about the jboss-remoting-commits
mailing list