Author: ron.sigal(a)jboss.com
Date: 2008-04-01 23:53:52 -0400 (Tue, 01 Apr 2008)
New Revision: 3834
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassUtil.java
Log:
JBREM-934: Put Thread().getContextClassLoader() and ClassLoader.getSystemClassLoader()
calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassUtil.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassUtil.java 2008-04-02
03:52:05 UTC (rev 3833)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassUtil.java 2008-04-02
03:53:52 UTC (rev 3834)
@@ -24,6 +24,8 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.Set;
import org.jboss.logging.Logger;
@@ -58,11 +60,16 @@
public static Object deserialize(byte buf[])
throws IOException, ClassNotFoundException
{
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if(cl == null)
+ ClassLoader cl = (ClassLoader) AccessController.doPrivileged( new
PrivilegedAction()
{
- cl = ClassUtil.class.getClassLoader();
- }
+ public Object run()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) loader = ClassUtil.class.getClassLoader();
+ return loader;
+ }
+ });
+
return deserialize(buf, cl);
}
@@ -194,7 +201,13 @@
if(cl == null)
{
- cl = ClassLoader.getSystemClassLoader();
+ cl = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return ClassLoader.getSystemClassLoader();
+ }
+ });
}
if(cl != null)
{
Show replies by date