[jboss-remoting-commits] JBoss Remoting SVN: r5277 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue May 19 14:52:16 EDT 2009
Author: ron.sigal at jboss.com
Date: 2009-05-19 14:52:15 -0400 (Tue, 19 May 2009)
New Revision: 5277
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/CleanDetectionTestClient.java
Log:
JBREM-1137: Wrapped call to new InitialContext() in PrivilegedExceptionAction.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/CleanDetectionTestClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/CleanDetectionTestClient.java 2009-05-19 18:51:16 UTC (rev 5276)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/CleanDetectionTestClient.java 2009-05-19 18:52:15 UTC (rev 5277)
@@ -156,7 +156,7 @@
env.put(Context.PROVIDER_URL, detectorHost + ":" + detectorPort);
env.put(Context.URL_PKG_PREFIXES, urlPackage);
- InitialContext initialContext = new InitialContext(env);
+ InitialContext initialContext = createContext(env);
String subContextName = JNDIDetector.DETECTION_SUBCONTEXT_NAME;
try
@@ -248,4 +248,27 @@
throw (NamingException) e.getCause();
}
}
+
+ static private InitialContext createContext(final Properties env) throws NamingException
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ return new InitialContext(env);
+ }
+
+ try
+ {
+ return (InitialContext) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return new InitialContext(env);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (RuntimeException) e.getCause();
+ }
+ }
}
More information about the jboss-remoting-commits
mailing list