[jboss-remoting-commits] JBoss Remoting SVN: r3854 - 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
Wed Apr 2 00:26:52 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-02 00:26:52 -0400 (Wed, 02 Apr 2008)
New Revision: 3854
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-934: Put Class.getClassLoader() and InetAddress.getByName() calls in AccessController.doPrivileged() calls.
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-02 04:26:05 UTC (rev 3853)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-04-02 04:26:52 UTC (rev 3854)
@@ -45,12 +45,12 @@
import javax.net.SocketFactory;
import java.beans.IntrospectionException;
-import java.io.BufferedOutputStream;
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;
@@ -63,6 +63,7 @@
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;
@@ -236,8 +237,16 @@
throw (IOException) e.getCause();
}
- unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), this.getClass().getClassLoader());
- marshaller = MarshalFactory.getMarshaller(getLocator(), this.getClass().getClassLoader());
+ ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return RMIServerInvoker.class.getClassLoader();
+ }
+ });
+
+ unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), classLoader);
+ marshaller = MarshalFactory.getMarshaller(getLocator(), classLoader);
}
@@ -451,8 +460,23 @@
}
try
{
- String clientHost = RemoteServer.getClientHost();
- metadata.put(Remoting.CLIENT_ADDRESS, InetAddress.getByName(clientHost));
+ 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();
+ }
+ metadata.put(Remoting.CLIENT_ADDRESS, clientAddress);
}
catch (ServerNotActiveException e)
{
More information about the jboss-remoting-commits
mailing list