Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:13:18 -0400 (Wed, 02 Apr 2008)
New Revision: 3846
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
Log:
JBREM-934: Put InetAddress.getLocalHost() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2008-04-02
04:12:05 UTC (rev 3845)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2008-04-02
04:13:18 UTC (rev 3846)
@@ -37,6 +37,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.AccessController;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
@@ -132,13 +133,39 @@
try
{
- host = InetAddress.getLocalHost().getHostName();
+ try
+ {
+ host = (String)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getLocalHost().getHostName();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
}
catch(UnknownHostException e)
{
try
{
- host = InetAddress.getLocalHost().getHostAddress();
+ try
+ {
+ host = (String)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ });
+ }
+ catch (PrivilegedActionException e2)
+ {
+ throw (UnknownHostException) e2.getCause();
+ }
}
catch(UnknownHostException e1)
{
Show replies by date