[jboss-remoting-commits] JBoss Remoting SVN: r3949 - remoting2/branches/2.x/src/main/org/jboss/remoting/stream.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Fri Apr 11 21:14:00 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-11 21:14:00 -0400 (Fri, 11 Apr 2008)
New Revision: 3949
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility 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-12 01:12:49 UTC (rev 3948)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2008-04-12 01:14:00 UTC (rev 3949)
@@ -30,6 +30,7 @@
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
import java.io.IOException;
@@ -116,96 +117,28 @@
private String getLocatorURI() throws IOException
{
// check for system properties for locator values
+ transport = SecurityUtility.getSystemProperty(STREAM_TRANSPORT_KEY, transport);
try
{
- transport = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return System.getProperty(STREAM_TRANSPORT_KEY, transport);
- }
- });
+ host = SecurityUtility.getLocalHostName();
}
- catch (Exception e)
- {
- log.debug("error", e.getCause());
- }
-
- try
- {
- 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
{
- try
- {
- host = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
- });
- }
- catch (PrivilegedActionException e2)
- {
- throw (UnknownHostException) e2.getCause();
- }
+ InetAddress localAddress = SecurityUtility.getLocalHost();
+ host = localAddress.getHostAddress();
}
catch(UnknownHostException e1)
{
log.error("Stream server could not determine local host or address.");
}
}
-
- 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 = 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());
- }
+ host = SecurityUtility.getSystemProperty(STREAM_HOST_KEY, host);
+ String defaultPort = "" + PortUtil.findFreePort(host);
+ String sPort = SecurityUtility.getSystemProperty(STREAM_PORT_KEY, defaultPort);
-
try
{
port = Integer.parseInt(sPort);
More information about the jboss-remoting-commits
mailing list