[jboss-remoting-commits] JBoss Remoting SVN: r5029 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue Apr 14 06:31:54 EDT 2009
Author: ron.sigal at jboss.com
Date: 2009-04-14 06:31:53 -0400 (Tue, 14 Apr 2009)
New Revision: 5029
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java
Log:
JBREM-1116: Eliminated dependence on SecurityUtility.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java 2009-04-14 10:31:30 UTC (rev 5028)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup/JNDIDetectorServer.java 2009-04-14 10:31:53 UTC (rev 5029)
@@ -38,6 +38,9 @@
import java.lang.reflect.Method;
import java.net.InetAddress;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
@@ -62,7 +65,7 @@
namingBeanImplClass = Class.forName("org.jnp.server.NamingBeanImpl");
namingBean = namingBeanImplClass.newInstance();
Method startMethod = namingBeanImplClass.getMethod("start", new Class[] {});
- SecurityUtility.setSystemProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ setSystemProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
startMethod.invoke(namingBean, new Object[] {});
}
catch (Exception e)
@@ -158,5 +161,28 @@
}
-
+
+ static private void setSystemProperty(final String name, final String value)
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ System.setProperty(name, value);
+ return;
+ }
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return System.setProperty(name, value);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (RuntimeException) e.getCause();
+ }
+ }
}
\ No newline at end of file
More information about the jboss-remoting-commits
mailing list