Author: ron.sigal(a)jboss.com
Date: 2008-03-26 00:35:00 -0400 (Wed, 26 Mar 2008)
New Revision: 3769
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
Log:
JBREM-934: Put System.getProperty() in AccessController.doPrivileged() call.
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-03-26
04:34:20 UTC (rev 3768)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2008-03-26
04:35:00 UTC (rev 3769)
@@ -36,6 +36,8 @@
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
/**
* This is a helper class that runs internal to remoting on the
@@ -113,9 +115,23 @@
private String getLocatorURI() throws IOException
{
// check for system properties for locator values
- transport = System.getProperty(STREAM_TRANSPORT_KEY, transport);
try
{
+ transport = (String)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return System.getProperty(STREAM_TRANSPORT_KEY, transport);
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ log.debug("error", e.getCause());
+ }
+
+ try
+ {
host = InetAddress.getLocalHost().getHostName();
}
catch(UnknownHostException e)
@@ -129,11 +145,42 @@
log.error("Stream server could not determine local host or
address.");
}
}
- host = System.getProperty(STREAM_HOST_KEY, host);
+
+ try
+ {
+ host = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return System.getProperty(STREAM_HOST_KEY, host);
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ log.debug("error", e.getCause());
+ }
+
- String sPort = System.getProperty(STREAM_PORT_KEY, "" +
PortUtil.findFreePort(host));
+ String sPort = null;
try
{
+ sPort = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return System.getProperty(STREAM_PORT_KEY, "" +
PortUtil.findFreePort(host));
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ log.debug("error", e.getCause());
+ }
+
+
+ try
+ {
port = Integer.parseInt(sPort);
}
catch(NumberFormatException e)
Show replies by date