JBoss Remoting SVN: r3846 - remoting2/branches/2.x/src/main/org/jboss/remoting/stream.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:13:18 -0400 (Wed, 02 Apr 2008)
New Revision: 3846
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java
Log:
JBREM-934: Put InetAddress.getLocalHost() calls in AccessController.doPrivileged() 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-02 04:12:05 UTC (rev 3845)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.java 2008-04-02 04:13:18 UTC (rev 3846)
@@ -37,6 +37,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.AccessController;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
@@ -132,13 +133,39 @@
try
{
- host = InetAddress.getLocalHost().getHostName();
+ 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
{
- host = InetAddress.getLocalHost().getHostAddress();
+ try
+ {
+ host = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ });
+ }
+ catch (PrivilegedActionException e2)
+ {
+ throw (UnknownHostException) e2.getCause();
+ }
}
catch(UnknownHostException e1)
{
16 years, 10 months
JBoss Remoting SVN: r3845 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:12:05 -0400 (Wed, 02 Apr 2008)
New Revision: 3845
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/LocalMarshalledValue.java
Log:
JBREM-934: Put Thread().getContextClassLoader() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/LocalMarshalledValue.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/LocalMarshalledValue.java 2008-04-02 04:11:26 UTC (rev 3844)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/LocalMarshalledValue.java 2008-04-02 04:12:05 UTC (rev 3845)
@@ -36,6 +36,8 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* Does lazy serialization based on JBossSerialization.
@@ -84,7 +86,14 @@
{
try
{
- container.getCache().setLoader(Thread.currentThread().getContextClassLoader());
+ ClassLoader tcl = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ container.getCache().setLoader(tcl);
return container.getInput().readObject();
}
catch(RuntimeException e)
16 years, 10 months
JBoss Remoting SVN: r3844 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:11:26 -0400 (Wed, 02 Apr 2008)
New Revision: 3844
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/MarshalledValueInputStream.java
Log:
JBREM-934: Put Thread().getContextClassLoader() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/MarshalledValueInputStream.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/MarshalledValueInputStream.java 2008-04-02 04:10:43 UTC (rev 3843)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/MarshalledValueInputStream.java 2008-04-02 04:11:26 UTC (rev 3844)
@@ -28,6 +28,9 @@
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
import org.jboss.logging.Logger;
/**
@@ -67,7 +70,13 @@
if(resolvedClass == null)
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
try
{
resolvedClass = Class.forName(className, false, loader);
@@ -116,7 +125,13 @@
{
if(loader == null)
{
- loader = Thread.currentThread().getContextClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
}
iface = Class.forName(className, false, loader);
}
16 years, 10 months
JBoss Remoting SVN: r3843 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:10:43 -0400 (Wed, 02 Apr 2008)
New Revision: 3843
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/SerializationManager.java
Log:
JBREM-934: Put Thread().getContextClassLoader() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/SerializationManager.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/SerializationManager.java 2008-04-02 04:09:57 UTC (rev 3842)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/SerializationManager.java 2008-04-02 04:10:43 UTC (rev 3843)
@@ -28,6 +28,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import org.jboss.remoting.Version;
@@ -43,7 +45,14 @@
{
public ObjectInputStream createRegularInput(InputStream input) throws IOException
{
- return createInput(input, Thread.currentThread().getContextClassLoader());
+ ClassLoader tcl = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ return createInput(input, tcl);
}
public abstract ObjectInputStream createInput(InputStream input, ClassLoader loader) throws IOException;
16 years, 10 months
JBoss Remoting SVN: r3842 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:09:57 -0400 (Wed, 02 Apr 2008)
New Revision: 3842
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/ClassLoaderUtility.java
Log:
JBREM-934: Put Thread().getContextClassLoader(), Class.getClassLoader(), and ClassLoader.getSystemClassLoader() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/ClassLoaderUtility.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/ClassLoaderUtility.java 2008-04-02 04:07:13 UTC (rev 3841)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/ClassLoaderUtility.java 2008-04-02 04:09:57 UTC (rev 3842)
@@ -21,6 +21,9 @@
*/
package org.jboss.remoting.serialization;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
/**
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
*/
@@ -36,13 +39,19 @@
* if no context class loader is available.
* @return Class, or null on failure.
*/
- public static Class loadClass(String classname, Class clazz) throws ClassNotFoundException
+ public static Class loadClass(String classname, final Class clazz) throws ClassNotFoundException
{
ClassLoader loader;
try
{
- loader = Thread.currentThread().getContextClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
if (loader != null)
{
return Class.forName(classname, false, loader);
@@ -56,7 +65,13 @@
{
try
{
- loader = clazz.getClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
if (loader != null)
{
return Class.forName(classname, false, loader);
@@ -69,7 +84,13 @@
try
{
- loader = ClassLoader.getSystemClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return ClassLoader.getSystemClassLoader();
+ }
+ });
if (loader != null)
{
return Class.forName(classname, false, loader);
@@ -91,7 +112,7 @@
* @param classname Desired class.
* @return Class, or null on failure.
*/
- public static Class loadClass(Class clazz, String classname) throws ClassNotFoundException
+ public static Class loadClass(final Class clazz, String classname) throws ClassNotFoundException
{
ClassLoader loader;
@@ -99,7 +120,14 @@
{
try
{
- loader = clazz.getClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
+
if (loader != null)
{
return Class.forName(classname, false, loader);
@@ -112,7 +140,13 @@
try
{
- loader = Thread.currentThread().getContextClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
if (loader != null)
{
return Class.forName(classname, false, loader);
@@ -125,7 +159,13 @@
try
{
- loader = ClassLoader.getSystemClassLoader();
+ loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return ClassLoader.getSystemClassLoader();
+ }
+ });
if (loader != null)
{
return Class.forName(classname, false, loader);
16 years, 10 months
JBoss Remoting SVN: r3841 - remoting2/branches/2.x/src/main/org/jboss/remoting/security.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:07:13 -0400 (Wed, 02 Apr 2008)
New Revision: 3841
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
Log:
JBREM-934: (1) Replace System.getProperty() calls with SystemUtility.getSystemProperty() calls; (2) put Thread().getContextClassLoader() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java 2008-04-02 04:04:08 UTC (rev 3840)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBuilder.java 2008-04-02 04:07:13 UTC (rev 3841)
@@ -22,8 +22,8 @@
package org.jboss.remoting.security;
import org.jboss.logging.Logger;
-import org.jboss.remoting.callback.CallbackStore.StoreFileFilter;
import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.remoting.util.SystemUtility;
import org.jboss.remoting.util.socket.RemotingKeyManager;
import javax.net.ServerSocketFactory;
@@ -396,7 +396,8 @@
if (getUseSSLSocketFactory())
{
- String defaultFactoryName = System.getProperty(REMOTING_DEFAULT_SOCKET_FACTORY_CLASS);
+ String defaultFactoryName = SystemUtility.getSystemProperty(REMOTING_DEFAULT_SOCKET_FACTORY_CLASS);
+
if (defaultFactoryName != null)
{
try
@@ -630,7 +631,7 @@
if(keyStoreFilePath == null)
{
- String path = System.getProperty(STANDARD_KEY_STORE_FILE_PATH);
+ String path = SystemUtility.getSystemProperty(STANDARD_KEY_STORE_FILE_PATH);;
if(path != null && path.length() > 0)
{
setKeyStoreURL( path );
@@ -684,8 +685,7 @@
if(keyStoreType == null)
{
- keyStoreType = System.getProperty(STANDARD_KEY_STORE_TYPE);
-
+ keyStoreType = SystemUtility.getSystemProperty(STANDARD_KEY_STORE_TYPE);
if(keyStoreType == null)
{
keyStoreType = DEFAULT_KEY_STORE_TYPE;
@@ -761,7 +761,7 @@
if(keyStorePassword == null)
{
- keyStorePassword = System.getProperty(STANDARD_KEY_STORE_PASSWORD);
+ keyStorePassword = SystemUtility.getSystemProperty(STANDARD_KEY_STORE_PASSWORD);
}
return keyStorePassword;
@@ -812,7 +812,7 @@
if(trustStoreFilePath == null)
{
- String path = System.getProperty(STANDARD_TRUST_STORE_FILE_PATH);
+ String path = SystemUtility.getSystemProperty(STANDARD_TRUST_STORE_FILE_PATH);
if(path != null && path.length() > 0)
{
setTrustStoreURL( path );
@@ -866,8 +866,7 @@
if(trustStoreType == null)
{
- trustStoreType = System.getProperty(STANDARD_TRUST_STORE_TYPE);
-
+ trustStoreType = SystemUtility.getSystemProperty(STANDARD_TRUST_STORE_TYPE);
if(trustStoreType == null)
{
trustStoreType = getKeyStoreType();
@@ -943,7 +942,7 @@
if(trustStorePassword == null)
{
- trustStorePassword = System.getProperty(STANDARD_TRUST_STORE_PASSWORD);
+ trustStorePassword = SystemUtility.getSystemProperty(STANDARD_TRUST_STORE_PASSWORD);
if(trustStorePassword == null)
{
trustStorePassword = getKeyStorePassword();
@@ -1641,7 +1640,13 @@
// not a file either, lastly try to locate this as a classpath resource
if(url == null)
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
url = loader.getResource(storePath);
}
}
16 years, 10 months
JBoss Remoting SVN: r3840 - remoting2/branches/2.x/src/main/org/jboss/remoting/security.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:04:08 -0400 (Wed, 02 Apr 2008)
New Revision: 3840
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocketFactoryWrapper.java
Log:
JBREM-934: Put ServerSocketFactory.createServerSocket() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocketFactoryWrapper.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocketFactoryWrapper.java 2008-04-02 04:02:50 UTC (rev 3839)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocketFactoryWrapper.java 2008-04-02 04:04:08 UTC (rev 3840)
@@ -25,6 +25,9 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
@@ -38,24 +41,84 @@
this.serverSocketFactory = serverSocketFactory;
}
- public ServerSocket createServerSocket(int i) throws IOException
+ public ServerSocket createServerSocket(final int i) throws IOException
{
- return serverSocketFactory.createServerSocket(i);
+ ServerSocket ss = null;
+ try
+ {
+ ss = (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return serverSocketFactory.createServerSocket(i);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ return ss;
}
- public ServerSocket createServerSocket(int i, int i1) throws IOException
+ public ServerSocket createServerSocket(final int i, final int i1) throws IOException
{
- return serverSocketFactory.createServerSocket(i, i1);
+ ServerSocket ss = null;
+ try
+ {
+ ss = (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return serverSocketFactory.createServerSocket(i, i1);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ return ss;
}
- public ServerSocket createServerSocket(int i, int i1, InetAddress inetAddress) throws IOException
+ public ServerSocket createServerSocket(final int i, final int i1, final InetAddress inetAddress) throws IOException
{
- return serverSocketFactory.createServerSocket(i, i1, inetAddress);
+ ServerSocket ss = null;
+ try
+ {
+ ss = (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return serverSocketFactory.createServerSocket(i, i1, inetAddress);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ return ss;
}
public ServerSocket createServerSocket() throws IOException
{
- return serverSocketFactory.createServerSocket();
+ ServerSocket ss = null;
+ try
+ {
+ ss = (ServerSocket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return serverSocketFactory.createServerSocket();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ return ss;
}
public ServerSocketFactoryMBean getDelegate()
16 years, 10 months
JBoss Remoting SVN: r3839 - remoting2/branches/2.x/src/main/org/jboss/remoting/security.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:02:50 -0400 (Wed, 02 Apr 2008)
New Revision: 3839
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/security/CustomSSLServerSocketFactory.java
Log:
JBREM-934: Put MBean proxy calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/CustomSSLServerSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/security/CustomSSLServerSocketFactory.java 2008-04-02 03:58:55 UTC (rev 3838)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/CustomSSLServerSocketFactory.java 2008-04-02 04:02:50 UTC (rev 3839)
@@ -3,12 +3,15 @@
*/
package org.jboss.remoting.security;
-import javax.net.ssl.SSLServerSocket;
-import javax.net.ssl.SSLServerSocketFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLServerSocketFactory;
+
/**
* SSL server socket factory whose configuration is customized.
*
@@ -174,14 +177,39 @@
{
if ( theBuilder != null )
{
- sock.setUseClientMode( theBuilder.isServerSocketUseClientMode() );
+
+ boolean isServerSocketUseClientMode = ((Boolean)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return new Boolean(theBuilder.isServerSocketUseClientMode());
+ }
+ })).booleanValue();
+
+ boolean isClientAuthModeWant = ((Boolean)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return new Boolean(theBuilder.isClientAuthModeWant());
+ }
+ })).booleanValue();
+
+ boolean isClientAuthModeNeed = ((Boolean)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return new Boolean(theBuilder.isClientAuthModeNeed());
+ }
+ })).booleanValue();
- if ( theBuilder.isClientAuthModeWant() )
+ sock.setUseClientMode( isServerSocketUseClientMode );
+
+ if ( isClientAuthModeWant )
{
sock.setNeedClientAuth( false );
sock.setWantClientAuth( true );
}
- else if ( theBuilder.isClientAuthModeNeed() )
+ else if ( isClientAuthModeNeed )
{
sock.setWantClientAuth( false );
sock.setNeedClientAuth( true );
16 years, 10 months
JBoss Remoting SVN: r3838 - remoting2/branches/2.x/src/main/org/jboss/remoting/network.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-01 23:58:55 -0400 (Tue, 01 Apr 2008)
New Revision: 3838
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryQuery.java
Log:
JBREM-934: Put MBeanServer.isInstanceOf() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryQuery.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryQuery.java 2008-04-02 03:57:42 UTC (rev 3837)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryQuery.java 2008-04-02 03:58:55 UTC (rev 3838)
@@ -22,10 +22,13 @@
package org.jboss.remoting.network;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
import javax.management.BadAttributeValueExpException;
import javax.management.BadBinaryOpValueExpException;
import javax.management.BadStringOperationException;
-import javax.management.InstanceNotFoundException;
import javax.management.InvalidApplicationException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -42,15 +45,22 @@
private MBeanServer server;
private static final long serialVersionUID = 2402056810602499064L;
- public boolean apply(ObjectName objectName) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException
+ public boolean apply(final ObjectName objectName) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException
{
try
{
- return server.isInstanceOf(objectName, NetworkRegistryMBean.class.getName());
+ return ((Boolean)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return new Boolean(server.isInstanceOf(objectName, NetworkRegistryMBean.class.getName()));
+ }
+ })).booleanValue();
}
- catch(InstanceNotFoundException e)
+ catch (PrivilegedActionException e)
{
}
+
return false;
}
16 years, 10 months
JBoss Remoting SVN: r3837 - remoting2/branches/2.x/src/main/org/jboss/remoting/network.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-01 23:57:42 -0400 (Tue, 01 Apr 2008)
New Revision: 3837
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryFinder.java
Log:
JBREM-934: Put MBeanServer.queryMBeans() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryFinder.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryFinder.java 2008-04-02 03:56:30 UTC (rev 3836)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistryFinder.java 2008-04-02 03:57:42 UTC (rev 3837)
@@ -22,6 +22,8 @@
package org.jboss.remoting.network;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectInstance;
@@ -41,9 +43,16 @@
* @param server
* @return
*/
- public static ObjectName find(MBeanServer server)
+ public static ObjectName find(final MBeanServer server)
{
- Set set = server.queryMBeans(null, new NetworkRegistryQuery());
+ Set set = (Set)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return server.queryMBeans(null, new NetworkRegistryQuery());
+ }
+ });
+
if(set.isEmpty())
{
return null;
16 years, 10 months