[jboss-remoting-commits] JBoss Remoting SVN: r3762 - remoting2/branches/2.x/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Mar 26 00:27:58 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-03-26 00:27:57 -0400 (Wed, 26 Mar 2008)
New Revision: 3762

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
Log:
JBREM-934: Put System.getProperty() 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-03-26 00:39:19 UTC (rev 3761)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java	2008-03-26 04:27:57 UTC (rev 3762)
@@ -22,6 +22,7 @@
 
 package org.jboss.remoting;
 
+import java.beans.IntrospectionException;
 import java.io.Serializable;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
@@ -30,6 +31,8 @@
 import java.net.UnknownHostException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -461,8 +464,25 @@
       }
       else if(host.indexOf("0.0.0.0") != -1)
       {
-         if(System.getProperty(SERVER_BIND_ADDRESS, "0.0.0.0").equals("0.0.0.0"))
+         String bindAddress = null;
+         try
          {
+            bindAddress = (String) AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return System.getProperty(SERVER_BIND_ADDRESS, "0.0.0.0");
+               }
+            });
+         }
+         catch (PrivilegedActionException e)
+         {
+            log.debug("error", e.getCause());
+            return "0.0.0.0";
+         }
+         
+         if(bindAddress.equals("0.0.0.0"))
+         {
             host = fixRemoteAddress(host);
          }
          else
@@ -480,14 +500,25 @@
          if(address == null)
          {
             boolean byHost = true;
-            String bindByHost = System.getProperty(BIND_BY_HOST, "True");
+            String bindByHost = "True";
+            
             try
             {
-               byHost = Boolean.getBoolean(bindByHost);
+               bindByHost = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+               {
+                  public Object run() throws Exception
+                  {
+                     return System.getProperty(BIND_BY_HOST, "True");
+                  }
+               });
             }
-            catch(Exception e)
+            catch (Exception e)
             {
+               log.debug("error", e.getCause());
             }
+
+            byHost = Boolean.valueOf(bindByHost).booleanValue();
+
             if(byHost)
             {
                return InetAddress.getLocalHost().getHostName();




More information about the jboss-remoting-commits mailing list