[jboss-remoting-commits] JBoss Remoting SVN: r3972 - 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 Apr 11 22:45:48 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-11 22:45:48 -0400 (Fri, 11 Apr 2008)
New Revision: 3972
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-934: (1) Took Registry.rebind() and PropertyEditors.mapJavaBeanProperties() out of AccessController.doPrivileged() calls; (2) replaced AccessController.doPrivileged() call with SecurityUtility 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-04-12 02:06:06 UTC (rev 3971)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-04-12 02:45:48 UTC (rev 3972)
@@ -39,33 +39,26 @@
import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.util.propertyeditor.PropertyEditors;
import org.jboss.logging.Logger;
import javax.net.SocketFactory;
-import java.beans.IntrospectionException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.rmi.AccessException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.ExportException;
-import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RemoteServer;
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.UnicastRemoteObject;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -147,26 +140,9 @@
protected void setup() throws Exception
{
- final Properties props = new Properties();
+ Properties props = new Properties();
props.putAll(getConfiguration());
-
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws IntrospectionException
- {
- PropertyEditors.mapJavaBeanProperties(RMIServerInvoker.this, props, false);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug(e.toString(), e);
- throw e;
- }
-
+ PropertyEditors.mapJavaBeanProperties(RMIServerInvoker.this, props, false);
super.setup();
}
@@ -203,9 +179,8 @@
throw new IOException(e.getMessage());
}
- final Registry finalRegistry = registry;
String bindHost = bindHome.host;
- final int bindPort = bindHome.port;
+ int bindPort = bindHome.port;
String clientConnectHost = connectHome.host;
if(clientConnectHost == null)
@@ -219,32 +194,8 @@
stub = UnicastRemoteObject.exportObject(this, bindPort, csf, ssf);
log.debug("Binding server to \"remoting/RMIServerInvoker/" + bindPort + "\" in registry");
-
- try
- {
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws AccessException, RemoteException
- {
- finalRegistry.rebind("remoting/RMIServerInvoker/" + bindPort, RMIServerInvoker.this);
- return null;
- }
- });
- }
- catch (Exception e)
- {
- log.debug(e.toString(), e);
- throw (IOException) e.getCause();
- }
-
- ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- return RMIServerInvoker.class.getClassLoader();
- }
- });
-
+ registry.rebind("remoting/RMIServerInvoker/" + bindPort, RMIServerInvoker.this);
+ ClassLoader classLoader = SecurityUtility.getClassLoader(RMIServerInvoker.class);
unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), classLoader);
marshaller = MarshalFactory.getMarshaller(getLocator(), classLoader);
}
@@ -460,22 +411,8 @@
}
try
{
- final String clientHost = RemoteServer.getClientHost();
- InetAddress clientAddress = null;
- try
- {
- clientAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getByName(clientHost);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ String clientHost = RemoteServer.getClientHost();
+ InetAddress clientAddress = SecurityUtility.getAddressByName(clientHost);
metadata.put(Remoting.CLIENT_ADDRESS, clientAddress);
}
catch (ServerNotActiveException e)
More information about the jboss-remoting-commits
mailing list