JBoss Remoting SVN: r3937 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:59:32 -0400 (Fri, 11 Apr 2008)
New Revision: 3937
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2008-04-12 00:58:59 UTC (rev 3936)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2008-04-12 00:59:32 UTC (rev 3937)
@@ -23,6 +23,7 @@
import org.jboss.remoting.detection.AbstractDetector;
import org.jboss.remoting.detection.Detection;
+import org.jboss.remoting.util.SecurityUtility;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -145,38 +146,11 @@
{
if(addr == null)
{
- try
- {
- this.addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws IOException
- {
- return InetAddress.getByName(defaultIP);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
+ addr = SecurityUtility.getAddressByName(defaultIP);
}
- // check to see if we're running on a machine with loopback and no NIC
- InetAddress localHost = null;
- try
- {
- localHost = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws IOException
- {
- return InetAddress.getLocalHost();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
+ // check to see if we're running on a machine with loopback and no NIC
+ InetAddress localHost = SecurityUtility.getLocalHost();
if(bindAddr == null && localHost.getHostAddress().equals("127.0.0.1"))
{
// use this to bind so multicast will work w/o network
18 years
JBoss Remoting SVN: r3936 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:58:59 -0400 (Fri, 11 Apr 2008)
New Revision: 3936
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() call with SecurityUtility.getLocalHostName().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java 2008-04-12 00:58:16 UTC (rev 3935)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDetector.java 2008-04-12 00:58:59 UTC (rev 3936)
@@ -28,6 +28,7 @@
import org.jboss.remoting.detection.Detection;
import org.jboss.remoting.ident.Identity;
import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.util.SecurityUtility;
import org.jnp.interfaces.NamingContextFactory;
import org.jnp.server.Main;
@@ -441,22 +442,8 @@
try
{
log.info("JNDI Server configuration information not present so will create a local server.");
-
- try
- {
- host = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws IOException
- {
- return InetAddress.getLocalHost().getHostName();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
-
+
+ host = SecurityUtility.getLocalHostName();
port = PortUtil.findFreePort(host);
log.info("Remoting JNDI detector starting JNDI server instance since none where specified via configuration.");
18 years
JBoss Remoting SVN: r3935 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:58:16 -0400 (Fri, 11 Apr 2008)
New Revision: 3935
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() calls with SecurityUtility calls..
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-04-12 00:56:37 UTC (rev 3934)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-04-12 00:58:16 UTC (rev 3935)
@@ -34,7 +34,7 @@
import org.jboss.remoting.security.SSLSocketBuilder;
import org.jboss.remoting.security.SSLSocketBuilderMBean;
import org.jboss.remoting.security.SSLSocketFactoryService;
-import org.jboss.remoting.util.SystemUtility;
+import org.jboss.remoting.util.SecurityUtility;
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
@@ -291,40 +291,12 @@
final ObjectName serverSocketFactoryObjName = new ObjectName(serverSocketFactoryString);
if (server != null)
{
- boolean isCorrectType = false;
- try
- {
- isCorrectType = ((Boolean)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- String className = SSLServerSocketFactoryServiceMBean.class.getName();
- return new Boolean(server.isInstanceOf(serverSocketFactoryObjName, className));
- }
- })).booleanValue();
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ String className = SSLServerSocketFactoryServiceMBean.class.getName();
+ boolean isCorrectType = SecurityUtility.isInstanceOf(server, serverSocketFactoryObjName, className);
if (isCorrectType)
{
- SSLSocketBuilderMBean sslSocketBuilder = null;
- try
- {
- sslSocketBuilder = (SSLSocketBuilderMBean)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return server.getAttribute(serverSocketFactoryObjName, "SSLSocketBuilder");
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ Object o = SecurityUtility.getMBeanAttribute(server, serverSocketFactoryObjName, "SSLSocketBuilder");
+ SSLSocketBuilderMBean sslSocketBuilder = (SSLSocketBuilderMBean) o;
if (sslSocketBuilder != null)
{
@@ -346,8 +318,9 @@
}
}
}
- catch (MalformedObjectNameException ignored)
+ catch (Exception ignored)
{
+ log.debug("error", ignored);
}
}
@@ -448,32 +421,15 @@
Map storeConfig = new HashMap();
storeConfig.putAll(owner.getConfiguration());
- String newFilePath = "data";
-
String filePath = (String) storeConfig.get(CallbackStore.FILE_PATH_KEY);
if(filePath == null)
{
- try
- {
- newFilePath = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return System.getProperty("jboss.server.data.dir", "data");
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug("error", e.getCause());
- }
+ filePath = SecurityUtility.getSystemProperty("jboss.server.data.dir", "data");
}
-
- String separator = SystemUtility.getSystemProperty("file.separator");
- newFilePath = newFilePath + separator + "remoting" + separator + sessionId;
+ String separator = SecurityUtility.getSystemProperty("file.separator");
+ String newFilePath = filePath + separator + "remoting" + separator + sessionId;
storeConfig.put(CallbackStore.FILE_PATH_KEY, newFilePath);
-
callbackStore.setConfig(storeConfig);
}
18 years
JBoss Remoting SVN: r3934 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:56:37 -0400 (Fri, 11 Apr 2008)
New Revision: 3934
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
Log:
JBREM-934: (1) Replaced AccessController.doPrivileged() with SecurityUtility calls; (2) renamed SystemUtility SecurityUtility.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-12 00:55:24 UTC (rev 3933)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-12 00:56:37 UTC (rev 3934)
@@ -24,7 +24,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.serialization.SerializationStreamFactory;
-import org.jboss.remoting.util.SystemUtility;
+import org.jboss.remoting.util.SecurityUtility;
import java.io.File;
import java.io.FileInputStream;
@@ -123,24 +123,18 @@
{
try
{
- filePath = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return System.getProperty("jboss.server.data.dir", "data");
- }
- });
+ filePath = SecurityUtility.getSystemProperty("jboss.server.data.dir", "data");
}
- catch (PrivilegedActionException e)
+ catch (Exception e)
{
- log.debug("error", e.getCause());
+ log.debug("error", e);
filePath = "data";
}
}
File storeFile = new File(filePath);
if (!storeFile.exists())
{
- boolean madeDir = SystemUtility.mkdirs(storeFile);
+ boolean madeDir = SecurityUtility.mkdirs(storeFile);
if (!madeDir)
{
throw new IOException("Can not create directory for store. Path given: " + filePath);
@@ -208,7 +202,7 @@
{
try
{
- String separator = SystemUtility.getSystemProperty("file.separator");
+ String separator = SecurityUtility.getSystemProperty("file.separator");
fileToDelete = filePath + separator + fileList[x];
final File currentFile = new File(fileToDelete);
@@ -358,25 +352,9 @@
{
// only getting the first one, which will be first one entered since the getting
// of the list is automatically ordered by the OS and all file names are numeric by time.
- String separator = SystemUtility.getSystemProperty("file.separator");
+ String separator = SecurityUtility.getSystemProperty("file.separator");
objectFilePath = filePath + separator + objectFileList[0];
-
- try
- {
- final String finalObjectFilePath = objectFilePath;
- inFile = (FileInputStream)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws FileNotFoundException
- {
- return new FileInputStream(finalObjectFilePath);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
-
+ inFile = SecurityUtility.getFileInputStream(objectFilePath);
in = SerializationStreamFactory.getManagerInstance(serializationType).createRegularInput(inFile);
try
@@ -478,7 +456,7 @@
}
StringBuffer path = new StringBuffer(filePath);
- String separator = SystemUtility.getSystemProperty("file.separator");
+ String separator = SecurityUtility.getSystemProperty("file.separator");
path.append(separator).append(String.valueOf(currentTimestamp));
path.append("-").append(timestampCounter).append(".").append(fileSuffix);
final File storeFile = new File(path.toString());
@@ -487,21 +465,7 @@
try
{
- try
- {
- outFile = (FileOutputStream)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws FileNotFoundException
- {
- return new FileOutputStream(storeFile, false);
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
-
+ outFile = SecurityUtility.getFileOutputStream(storeFile, false);
if (serializationType.indexOf("jboss") > 0)
{
out = SerializationStreamFactory.getManagerInstance(serializationType).createOutput(outFile);
18 years
JBoss Remoting SVN: r3933 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:55:24 -0400 (Fri, 11 Apr 2008)
New Revision: 3933
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java
Log:
JBREM-934: Renamed SystemUtility to SecurityUtility.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2008-04-12 00:54:18 UTC (rev 3932)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2008-04-12 00:55:24 UTC (rev 3933)
@@ -22,11 +22,8 @@
package org.jboss.remoting;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+import org.jboss.remoting.util.SecurityUtility;
-import org.jboss.remoting.util.SystemUtility;
-
/**
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
*/
@@ -53,7 +50,7 @@
static
{
boolean precompatibleFlag = false;
- String precompatible = SystemUtility.getSystemProperty(PRE_2_0_COMPATIBLE);
+ String precompatible = SecurityUtility.getSystemProperty(PRE_2_0_COMPATIBLE);
if(precompatible != null && precompatible.length() > 0)
{
@@ -67,7 +64,7 @@
}
else
{
- String userDefinedVersion = SystemUtility.getSystemProperty(REMOTING_VERSION_TO_USE);
+ String userDefinedVersion = SecurityUtility.getSystemProperty(REMOTING_VERSION_TO_USE);
if(userDefinedVersion != null && userDefinedVersion.length() > 0)
{
@@ -88,7 +85,7 @@
}
else
{
- SystemUtility.setSystemProperty(REMOTING_VERSION_TO_USE, new Byte(defaultByteVersion).toString());
+ SecurityUtility.setSystemProperty(REMOTING_VERSION_TO_USE, new Byte(defaultByteVersion).toString());
}
}
}
18 years
JBoss Remoting SVN: r3932 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:54:18 -0400 (Fri, 11 Apr 2008)
New Revision: 3932
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() with SecurityUtility.getLocalHost() and Security.getAddressByName().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-04-12 00:53:13 UTC (rev 3931)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-04-12 00:54:18 UTC (rev 3932)
@@ -36,6 +36,7 @@
import org.jboss.remoting.stream.StreamHandler;
import org.jboss.remoting.stream.StreamInvocationHandler;
import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
@@ -55,7 +56,6 @@
import java.lang.reflect.Constructor;
import java.net.InetAddress;
import java.net.MalformedURLException;
-import java.net.UnknownHostException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -1136,28 +1136,15 @@
}
// If no bind address(es) found, try the old way.
- final String locatorHost = locator.getHost();
+ String locatorhost = locator.getHost();
InetAddress addr = null;
- try
+ if(locatorhost != null)
{
- addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- if(locatorHost != null)
- {
- return InetAddress.getByName(locator.getHost());
- }
- else
- {
- return InetAddress.getLocalHost();
- }
- }
- });
+ addr = SecurityUtility.getAddressByName(locatorhost);
}
- catch (PrivilegedActionException e)
+ else
{
- throw (UnknownHostException) e.getCause();
+ addr = SecurityUtility.getLocalHost();
}
int port = locator.getPort();
@@ -1174,20 +1161,7 @@
if(clientConnectAddress != null)
{
// can't use uri address, as is for client only
- try
- {
- serverBindAddress = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ serverBindAddress = SecurityUtility.getLocalHost().getHostAddress();
}
else
{
18 years
JBoss Remoting SVN: r3931 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:53:13 -0400 (Fri, 11 Apr 2008)
New Revision: 3931
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java
Log:
JBREM-934: Added SKIP_ACCESS_CONTROL.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2008-04-12 00:52:18 UTC (rev 3930)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2008-04-12 00:53:13 UTC (rev 3931)
@@ -22,6 +22,7 @@
package org.jboss.remoting;
+
public class Remoting
{
private Remoting() {}
@@ -68,4 +69,10 @@
* Key for configuring Remoting wire version.
*/
public static final String REMOTING_VERSION = "remotingVersion";
+
+ /**
+ * Key for telling Remoting to execute security sensitive code outside of
+ * java.security.AccessController.doPrivileged() calls.
+ */
+ public static final String SKIP_ACCESS_CONTROL = "skipAccessControl";
}
18 years
JBoss Remoting SVN: r3930 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:52:18 -0400 (Fri, 11 Apr 2008)
New Revision: 3930
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() with SecurityUtility.getMethod().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java 2008-04-12 00:51:33 UTC (rev 3929)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java 2008-04-12 00:52:18 UTC (rev 3930)
@@ -29,6 +29,7 @@
import org.jboss.remoting.transport.ClientInvoker;
import org.jboss.remoting.transport.ServerFactory;
import org.jboss.remoting.transport.local.LocalClientInvoker;
+import org.jboss.remoting.util.SecurityUtility;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -418,24 +419,9 @@
if(transportFactoryClass != null)
{
ClientFactory transportFactory = (ClientFactory)transportFactoryClass.newInstance();
- Method getClientInvokerMethod = null;
-
- try
- {
- final Class finalClass = transportFactoryClass;
- getClientInvokerMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return finalClass.getMethod("createClientInvoker", new Class[] {InvokerLocator.class, Map.class});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Method getClientInvokerMethod = SecurityUtility.getMethod(transportFactoryClass,
+ "createClientInvoker",
+ new Class[] {InvokerLocator.class, Map.class});
clientInvoker = (ClientInvoker)getClientInvokerMethod.invoke(transportFactory, new Object[] {locator, configuration});
}
else
@@ -454,24 +440,9 @@
if(transportFactoryClass != null)
{
ServerFactory transportFactory = (ServerFactory)transportFactoryClass.newInstance();
- Method getServerInvokerMethod = null;
-
- try
- {
- final Class finalClass = transportFactoryClass;
- getServerInvokerMethod = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return finalClass.getMethod("createServerInvoker", new Class[] {InvokerLocator.class, Map.class});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Method getServerInvokerMethod = SecurityUtility.getMethod(transportFactoryClass,
+ "createServerInvoker",
+ new Class[] {InvokerLocator.class, Map.class});
serverInvoker = (ServerInvoker)getServerInvokerMethod.invoke(transportFactory, new Object[] {locator, configuration});
}
else
@@ -673,24 +644,7 @@
{
transportFactoryClass = getTransportClientFactory(transport);
ClientFactory clientFactory = (ClientFactory)transportFactoryClass.newInstance();
- Method meth = null;
-
- try
- {
- final Class finalClass = transportFactoryClass;
- meth = (Method)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return finalClass.getMethod("supportsSSL", new Class[]{});
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
-
+ Method meth = SecurityUtility.getMethod(transportFactoryClass, "supportsSSL", new Class[]{});
Boolean boolVal = (Boolean)meth.invoke(clientFactory, null);
isSSLSupported = boolVal.booleanValue();
}
18 years
JBoss Remoting SVN: r3929 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:51:33 -0400 (Fri, 11 Apr 2008)
New Revision: 3929
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() with SecurityUtility.getSystemProperty().
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-12 00:49:56 UTC (rev 3928)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java 2008-04-12 00:51:33 UTC (rev 3929)
@@ -42,7 +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;
+import org.jboss.remoting.util.SecurityUtility;
/**
* InvokerLocator is an object that indentifies a specific Invoker on the network, via a unique
@@ -315,7 +315,7 @@
}
else
{
- String s = SystemUtility.getSystemProperty(LEGACY_PARSING);
+ String s = SecurityUtility.getSystemProperty(LEGACY_PARSING);
doLegacyParsing = "true".equalsIgnoreCase(s);
}
@@ -457,30 +457,14 @@
}
else if(host.indexOf("0.0.0.0") != -1)
{
- 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";
- }
-
+ String bindAddress = SecurityUtility.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", SystemUtility.getSystemProperty(SERVER_BIND_ADDRESS));
+ host = host.replaceAll("0\\.0\\.0\\.0", SecurityUtility.getSystemProperty(SERVER_BIND_ADDRESS));
}
}
return host;
18 years
JBoss Remoting SVN: r3928 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-11 20:49:56 -0400 (Fri, 11 Apr 2008)
New Revision: 3928
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
Log:
JBREM-934: Replaced AccessController.doPrivileged() with SecurityUtility.getLocalHost().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2008-04-10 20:23:49 UTC (rev 3927)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2008-04-12 00:49:56 UTC (rev 3928)
@@ -38,6 +38,7 @@
import org.jboss.remoting.transport.Connector;
import org.jboss.remoting.transport.PortUtil;
import org.jboss.remoting.transport.local.LocalClientInvoker;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.util.id.GUID;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
@@ -52,12 +53,9 @@
import java.io.StreamCorruptedException;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
-import java.net.UnknownHostException;
import java.rmi.MarshalException;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -941,20 +939,7 @@
}
if (host == null)
{
- try
- {
- host = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws UnknownHostException
- {
- return InetAddress.getLocalHost().getHostAddress();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (UnknownHostException) e.getCause();
- }
+ host = SecurityUtility.getLocalHost().getHostAddress();
metadata.put(CALLBACK_SERVER_HOST, host);
}
if (port == -1)
18 years