[jboss-remoting-commits] JBoss Remoting SVN: r3822 - remoting2/branches/2.x/src/main/org/jboss/remoting.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue Apr 1 23:02:38 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-01 23:02:38 -0400 (Tue, 01 Apr 2008)
New Revision: 3822
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
Log:
JBREM-934: Put InetAddress.getLocalHost() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java 2008-04-02 02:58:42 UTC (rev 3821)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java 2008-04-02 03:02:38 UTC (rev 3822)
@@ -22,7 +22,6 @@
package org.jboss.remoting;
-import java.beans.IntrospectionException;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.MalformedURLException;
@@ -30,7 +29,6 @@
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
@@ -44,6 +42,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.serialization.SerializationStreamFactory;
import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.util.SystemUtility;
/**
* InvokerLocator is an object that indentifies a specific Invoker on the network, via a unique
@@ -316,13 +315,7 @@
}
else
{
- String s = (String)AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- return System.getProperty(LEGACY_PARSING);
- }
- });
+ String s = SystemUtility.getSystemProperty(LEGACY_PARSING);
doLegacyParsing = "true".equalsIgnoreCase(s);
}
@@ -487,7 +480,7 @@
}
else
{
- host = host.replaceAll("0\\.0\\.0\\.0", System.getProperty(SERVER_BIND_ADDRESS));
+ host = host.replaceAll("0\\.0\\.0\\.0", SystemUtility.getSystemProperty(SERVER_BIND_ADDRESS));
}
}
return host;
@@ -495,43 +488,34 @@
private static String fixRemoteAddress(String address)
{
- try
+ if(address == null)
{
- if(address == null)
+ try
{
- boolean byHost = true;
- String bindByHost = "True";
-
- try
+ address = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- bindByHost = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ public Object run() throws UnknownHostException
{
- public Object run() throws Exception
+ String bindByHost = System.getProperty(BIND_BY_HOST, "True");
+ boolean byHost = Boolean.valueOf(bindByHost).booleanValue();
+
+ if(byHost)
{
- return System.getProperty(BIND_BY_HOST, "True");
+ return InetAddress.getLocalHost().getHostName();
}
- });
- }
- catch (Exception e)
- {
- log.debug("error", e.getCause());
- }
-
- byHost = Boolean.valueOf(bindByHost).booleanValue();
-
- if(byHost)
- {
- return InetAddress.getLocalHost().getHostName();
- }
- else
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
+ else
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ }
+ });
}
+ catch (PrivilegedActionException e)
+ {
+ log.debug("error", e.getCause());
+ }
}
- catch(UnknownHostException ignored)
- {
- }
+
return address;
}
More information about the jboss-remoting-commits
mailing list