[jboss-cvs] JBossAS SVN: r60754 - branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/naming.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 21 06:32:07 EST 2007
Author: wolfc
Date: 2007-02-21 06:32:03 -0500 (Wed, 21 Feb 2007)
New Revision: 60754
Modified:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/naming/SimpleMultiplexer.java
Log:
Using privileged action (EJBTHREE-889).
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/naming/SimpleMultiplexer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/naming/SimpleMultiplexer.java 2007-02-21 10:53:15 UTC (rev 60753)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/naming/SimpleMultiplexer.java 2007-02-21 11:32:03 UTC (rev 60754)
@@ -21,6 +21,8 @@
*/
package org.jboss.ejb3.naming;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Hashtable;
import javax.naming.Context;
@@ -49,12 +51,32 @@
{
Context ctxTwo = (Context) ctx.lookup("comp.ejb3");
Context ctxOne = (Context) ctx.lookup("comp.original");
- //log.trace("contextClassLoader = " + Thread.currentThread().getContextClassLoader() + " ctxOne = " + ctxOne);
+ if(log.isTraceEnabled())
+ {
+ log.trace("contextClassLoader = " + getContextClassLoader() + " ctxOne = " + ctxOne);
+ }
if(ctxTwo == null)
return ctxOne;
return new MultiplexerContext(ctxOne, ctxTwo);
}
+ private static ClassLoader getContextClassLoader()
+ {
+ if(System.getSecurityManager() == null)
+ return Thread.currentThread().getContextClassLoader();
+ else
+ {
+ PrivilegedAction<ClassLoader> action = new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+ }
+
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception
{
if(nameCtx == null)
More information about the jboss-cvs-commits
mailing list