From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:31:57 2009 Content-Type: multipart/mixed; boundary="===============8306366781584033615==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5029 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup. Date: Tue, 14 Apr 2009 06:31:54 -0400 Message-ID: --===============8306366781584033615== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)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/detectio= n/jndi/startup/JNDIDetectorServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Tom Elrod @@ -62,7 +65,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -158,5 +161,28 @@ = } = - + = + static private void setSystemProperty(final String name, final String v= alue) + { + 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 --===============8306366781584033615==--