[jboss-remoting-commits] JBoss Remoting SVN: r3823 - remoting2/branches/2.x/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Apr 1 23:04:10 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-04-01 23:04:10 -0400 (Tue, 01 Apr 2008)
New Revision: 3823

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-934: Put Thread.currentThread() in AccessController.doPrivileged() call.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2008-04-02 03:02:38 UTC (rev 3822)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2008-04-02 03:04:10 UTC (rev 3823)
@@ -14,9 +14,6 @@
 import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -120,7 +117,13 @@
          // class loader.  This allows to load remoting classes as well as user's
          // classes.  If possible, will simply reset context classloader on existing
          // RemotingClassLoader.
-         final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+         final ClassLoader contextClassLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+         {
+            public Object run()
+            {
+               return Thread.currentThread().getContextClassLoader();
+            }
+         });
          if (unmarshaller instanceof UpdateableClassloaderUnMarshaller)
          {
             UpdateableClassloaderUnMarshaller uclum = (UpdateableClassloaderUnMarshaller) unmarshaller;
@@ -367,12 +370,26 @@
 
    public void setUnMarshaller(UnMarshaller unmarshaller)
    {
-      unmarshallers.put(Thread.currentThread().getContextClassLoader(), unmarshaller);
+      ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+      {
+         public Object run()
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+      });
+      unmarshallers.put(classLoader, unmarshaller);
    }
 
    public UnMarshaller getUnMarshaller()
    {
-      return (UnMarshaller)unmarshallers.get(Thread.currentThread().getContextClassLoader());
+      ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+      {
+         public Object run()
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+      });
+      return (UnMarshaller)unmarshallers.get(classLoader);
    }
    
    public String getSessionId()




More information about the jboss-remoting-commits mailing list