JBoss Remoting SVN: r3967 - remoting2/branches/2.x/src/main/org/jboss/remoting/transporter.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:45:35 -0400 (Fri, 11 Apr 2008)
New Revision: 3967
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterHandler.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.getMethod() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterHandler.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterHandler.java 2008-04-12 01:45:13 UTC (rev 3966)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterHandler.java 2008-04-12 01:45:35 UTC (rev 3967)
@@ -26,6 +26,7 @@
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.invocation.NameBasedInvocation;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
import java.lang.reflect.Method;
@@ -82,22 +83,7 @@
}
// use reflection to make the call
- Method method = null;
- try
- {
- method = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return targetPOJO.getClass().getMethod(methodName, classSig);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Method method = SecurityUtility.getMethod(targetPOJO.getClass(), methodName, classSig);
Object responseObject = method.invoke(targetPOJO, params);
return responseObject;
18 years
JBoss Remoting SVN: r3966 - remoting2/branches/2.x/src/main/org/jboss/remoting/transporter.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:45:13 -0400 (Fri, 11 Apr 2008)
New Revision: 3966
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterClient.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.createMBeanServer() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterClient.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterClient.java 2008-04-12 01:44:49 UTC (rev 3965)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/TransporterClient.java 2008-04-12 01:45:13 UTC (rev 3966)
@@ -31,9 +31,9 @@
import org.jboss.remoting.invocation.NameBasedInvocation;
import org.jboss.remoting.network.NetworkInstance;
import org.jboss.remoting.network.NetworkRegistry;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -41,8 +41,6 @@
import java.lang.reflect.Proxy;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
/**
@@ -135,21 +133,7 @@
if (!services.isSetup())
{
// we need an MBeanServer to store our network registry and multicast detector services
- MBeanServer server = null;
- try
- {
- server = (MBeanServer) AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return MBeanServerFactory.createMBeanServer();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ MBeanServer server = SecurityUtility.createMBeanServer();
// multicast detector will detect new network registries that come online
MulticastDetector detector = new MulticastDetector();
18 years
JBoss Remoting SVN: r3965 - remoting2/branches/2.x/src/main/org/jboss/remoting/transporter.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:44:49 -0400 (Fri, 11 Apr 2008)
New Revision: 3965
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.registerMBean() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java 2008-04-12 01:43:43 UTC (rev 3964)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalTransporterServices.java 2008-04-12 01:44:49 UTC (rev 3965)
@@ -10,6 +10,7 @@
import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.remoting.detection.Detector;
import org.jboss.remoting.network.NetworkRegistry;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -239,21 +240,7 @@
if (registerDetector)
{
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- m_mBeanServer.registerMBean(m_detector, m_detectorName);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ SecurityUtility.registerMBean(m_mBeanServer, m_detector, m_detectorName);
}
}
@@ -311,22 +298,8 @@
m_networkRegistryName = registryName;
if (registerRegistry)
- {
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- m_mBeanServer.registerMBean(m_networkRegistry, m_networkRegistryName);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ {
+ SecurityUtility.registerMBean(m_mBeanServer, m_networkRegistry, m_networkRegistryName);
}
}
18 years
JBoss Remoting SVN: r3964 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:43:43 -0400 (Fri, 11 Apr 2008)
New Revision: 3964
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-04-12 01:43:08 UTC (rev 3963)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-04-12 01:43:43 UTC (rev 3964)
@@ -25,6 +25,7 @@
import org.jboss.remoting.Home;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.remoting.util.TimerUtil;
import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
import org.jboss.util.propertyeditor.PropertyEditors;
@@ -311,26 +312,8 @@
ss.setReuseAddress(getReuseAddress());
configureServerSocket(ss);
- final InetSocketAddress address = new InetSocketAddress(bindAddress, serverBindPort);
- final ServerSocket finalServerSocket = ss;
-
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- finalServerSocket.bind(address, backlog);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
-
-
+ InetSocketAddress address = new InetSocketAddress(bindAddress, serverBindPort);
+ SecurityUtility.bind(ss, address, backlog);
return ss;
}
@@ -342,22 +325,7 @@
while (it.hasNext())
{
Home home = (Home) it.next();
- InetAddress inetAddress = null;
- try
- {
- final Home finalHome = home;
- inetAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(finalHome.host);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ InetAddress inetAddress = SecurityUtility.getAddressByName(home.host);
ServerSocket ss = null;
try
@@ -366,7 +334,7 @@
ss.setReuseAddress(getReuseAddress());
configureServerSocket(ss);
InetSocketAddress address = new InetSocketAddress(inetAddress, home.port);
- ss.bind(address, backlog);
+ SecurityUtility.bind(ss, address, backlog);
if (log.isDebugEnabled()) log.debug(this + " created " + ss);
}
catch (SocketException e)
@@ -1028,22 +996,7 @@
if(trace) { log.trace(this + " is going to wait on 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();
- }
-
+ Socket socket = SecurityUtility.accept(serverSocket);
if(trace) { log.trace(this + " accepted " + socket); }
// the acceptor thread should spend as little time as possbile doing any kind of
18 years
JBoss Remoting SVN: r3963 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:43:08 -0400 (Fri, 11 Apr 2008)
New Revision: 3963
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.connect() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java 2008-04-12 01:42:21 UTC (rev 3962)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java 2008-04-12 01:43:08 UTC (rev 3963)
@@ -27,6 +27,7 @@
import org.jboss.remoting.InvocationFailureException;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.remoting.util.SecurityUtility;
import javax.net.SocketFactory;
import java.io.IOException;
@@ -35,10 +36,6 @@
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.InetSocketAddress;
-import java.rmi.MarshalException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.Map;
/**
@@ -188,7 +185,7 @@
}
configureSocket(s);
- final InetSocketAddress inetAddr = new InetSocketAddress(address, port);
+ InetSocketAddress inetAddr = new InetSocketAddress(address, port);
if (timeout < 0)
{
@@ -196,26 +193,8 @@
if (timeout < 0)
timeout = 0;
}
-
- final Socket finalSocket = s;
- final int finalTimeout = timeout;
-
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- finalSocket.connect(inetAddr, finalTimeout);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
+ SecurityUtility.connect(s, inetAddr, timeout);
return s;
}
18 years
JBoss Remoting SVN: r3962 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)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;
}
18 years
JBoss Remoting SVN: r3961 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:41:00 -0400 (Fri, 11 Apr 2008)
New Revision: 3961
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.getMethod() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-04-12 01:40:07 UTC (rev 3960)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-04-12 01:41:00 UTC (rev 3961)
@@ -27,6 +27,7 @@
import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@@ -273,24 +274,8 @@
{
try
{
- final Class c = Class.forName("java.lang.management.ManagementFactory");
- Method m = null;
-
- try
- {
- m = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return c.getMethod("getPlatformMBeanServer", new Class[] {});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Class c = Class.forName("java.lang.management.ManagementFactory");
+ Method m = SecurityUtility.getMethod(c, "getPlatformMBeanServer", new Class[] {});
MBeanServer s = (MBeanServer) m.invoke(null, new Object[] {});
log.debug("Using platform MBeanServer");
return s;
18 years
JBoss Remoting SVN: r3960 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:40:07 -0400 (Fri, 11 Apr 2008)
New Revision: 3960
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility.getAddressByName() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2008-04-12 01:38:26 UTC (rev 3959)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2008-04-12 01:40:07 UTC (rev 3960)
@@ -36,6 +36,7 @@
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.remoting.transport.web.WebServerInvoker;
import org.jboss.remoting.transport.web.WebUtil;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.logging.Logger;
import javax.servlet.ServletException;
@@ -147,23 +148,8 @@
}
}
- final String remoteAddressString = request.getRemoteAddr();
- InetAddress remoteAddress = null;
- try
- {
- remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(remoteAddressString);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
-
+ String remoteAddressString = request.getRemoteAddr();
+ InetAddress remoteAddress = SecurityUtility.getAddressByName(remoteAddressString);
Map requestPayload = invocationRequest.getRequestPayload();
if (requestPayload == null)
@@ -304,22 +290,8 @@
}
}
- final String remoteAddressString = request.getRemoteAddr();
- InetAddress remoteAddress = null;
- try
- {
- remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(remoteAddressString);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ String remoteAddressString = request.getRemoteAddr();
+ InetAddress remoteAddress = SecurityUtility.getAddressByName(remoteAddressString);
Map requestPayload = invocationRequest.getRequestPayload();
if (requestPayload == null)
18 years
JBoss Remoting SVN: r3959 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 21:38:26 -0400 (Fri, 11 Apr 2008)
New Revision: 3959
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-04-12 01:26:54 UTC (rev 3958)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-04-12 01:38:26 UTC (rev 3959)
@@ -42,15 +42,12 @@
import org.jboss.remoting.marshal.rmi.RMIUnMarshaller;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
-import org.jboss.util.propertyeditor.PropertyEditors;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
import org.jboss.util.threadpool.RunnableTaskWrapper;
import org.jboss.util.threadpool.Task;
import org.jboss.util.threadpool.ThreadPool;
-import java.beans.IntrospectionException;
-import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -60,9 +57,6 @@
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -236,22 +230,23 @@
log.debug(this + " trying to connect to: " + home);
Remote remoteObj = null;
- try
- {
- remoteObj = (Remote) AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return registry.lookup("remoting/RMIServerInvoker/" + port);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug(e.toString(), e);
- throw (Exception) e.getCause();
- }
+// try
+// {
+// remoteObj = (Remote) AccessController.doPrivileged( new PrivilegedExceptionAction()
+// {
+// public Object run() throws Exception
+// {
+// return registry.lookup("remoting/RMIServerInvoker/" + port);
+// }
+// });
+// }
+// catch (PrivilegedActionException e)
+// {
+// log.debug(e.toString(), e);
+// throw (Exception) e.getCause();
+// }
+ remoteObj = registry.lookup("remoting/RMIServerInvoker/" + port);
log.debug("Remote RMI Stub: " + remoteObj);
setServerStub((RMIServerInvokerInf) remoteObj);
connected = true;
18 years
JBoss Remoting SVN: r3958 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)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);
18 years