[jboss-remoting-commits] JBoss Remoting SVN: r4993 - 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 14 06:09:35 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-04-14 06:09:35 -0400 (Tue, 14 Apr 2009)
New Revision: 4993

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
Log:
JBREM-1116: Eliminated dependence on SecurityUtility.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java	2009-04-14 10:09:05 UTC (rev 4992)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java	2009-04-14 10:09:35 UTC (rev 4993)
@@ -369,7 +369,7 @@
       }
       else 
       {
-         String s = SecurityUtility.getSystemProperty(LEGACY_PARSING);
+         String s = getSystemProperty(LEGACY_PARSING);
          doLegacyParsing = "true".equalsIgnoreCase(s);
       }
 
@@ -511,14 +511,14 @@
       }
       else if(host.indexOf("0.0.0.0") != -1)
       {
-         String bindAddress = SecurityUtility.getSystemProperty(SERVER_BIND_ADDRESS, "0.0.0.0");         
+         String bindAddress = getSystemProperty(SERVER_BIND_ADDRESS, "0.0.0.0");         
          if(bindAddress.equals("0.0.0.0"))
          {
             host = fixRemoteAddress(host);
          }
          else
          {
-            host = host.replaceAll("0\\.0\\.0\\.0", SecurityUtility.getSystemProperty(SERVER_BIND_ADDRESS));
+            host = host.replaceAll("0\\.0\\.0\\.0", getSystemProperty(SERVER_BIND_ADDRESS));
          }
       }
       return host;
@@ -941,4 +941,52 @@
       sb.append(s.substring(fromIndex));
       return sb.toString();
    }
+   
+   static private String getSystemProperty(final String name, final String defaultValue)
+   {
+      if (SecurityUtility.skipAccessControl())
+         return System.getProperty(name, defaultValue);
+         
+      String value = null;
+      try
+      {
+         value = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws Exception
+            {
+               return System.getProperty(name, defaultValue);
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (RuntimeException) e.getCause();
+      }
+      
+      return value;
+   }
+   
+   static private String getSystemProperty(final String name)
+   {
+      if (SecurityUtility.skipAccessControl())
+         return System.getProperty(name);
+      
+      String value = null;
+      try
+      {
+         value = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws Exception
+            {
+               return System.getProperty(name);
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (RuntimeException) e.getCause();
+      }
+      
+      return value;
+   }
 }




More information about the jboss-remoting-commits mailing list