[jboss-remoting-commits] JBoss Remoting SVN: r3716 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Fri Mar 21 00:53:35 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-03-21 00:53:35 -0400 (Fri, 21 Mar 2008)
New Revision: 3716
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-934: Put Registry.rebind() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-03-21 04:41:03 UTC (rev 3715)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-03-21 04:53:35 UTC (rev 3716)
@@ -51,6 +51,7 @@
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
+import java.rmi.AccessException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
@@ -191,7 +192,7 @@
protected void initRMI(Home bindHome, Home connectHome) throws IOException
{
- Registry registry = null;
+ final Registry registry = null;
try
{
registry = getRegistry();
@@ -202,7 +203,7 @@
}
String bindHost = bindHome.host;
- int bindPort = bindHome.port;
+ final int bindPort = bindHome.port;
String clientConnectHost = connectHome.host;
if(clientConnectHost == null)
@@ -216,7 +217,23 @@
stub = UnicastRemoteObject.exportObject(this, bindPort, csf, ssf);
log.debug("Binding server to \"remoting/RMIServerInvoker/" + bindPort + "\" in registry");
- registry.rebind("remoting/RMIServerInvoker/" + bindPort, this);
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws AccessException, RemoteException
+ {
+ registry.rebind("remoting/RMIServerInvoker/" + bindPort, RMIServerInvoker.this);
+ return null;
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ log.debug(e.toString(), e);
+ throw (IOException) e.getCause();
+ }
unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), this.getClass().getClassLoader());
marshaller = MarshalFactory.getMarshaller(getLocator(), this.getClass().getClassLoader());
More information about the jboss-remoting-commits
mailing list