Author: ron.sigal(a)jboss.com
Date: 2008-04-01 23:52:05 -0400 (Tue, 01 Apr 2008)
New Revision: 3833
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
Log:
JBREM-934: Put ClassLoader.getSystemClassLoader() call in AccessController.doPrivileged()
call.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-04-02
03:49:26 UTC (rev 3832)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-04-02
03:52:05 UTC (rev 3833)
@@ -23,7 +23,6 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -31,6 +30,9 @@
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -152,7 +154,7 @@
super.finalize();
}
- public Class loadClass(String className, ClassBytes bytes[])
+ public Class loadClass(final String className, ClassBytes bytes[])
throws ClassNotFoundException, java.io.IOException
{
// make sure we're OK on the reference queue
@@ -179,7 +181,20 @@
{
return cl;
}
- cl = Class.forName(className, false, ClassLoader.getSystemClassLoader());
+ try
+ {
+ cl = (Class)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws ClassNotFoundException
+ {
+ return Class.forName(className, false,
ClassLoader.getSystemClassLoader());
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (ClassNotFoundException) e.getCause();
+ }
if(cl != null)
{
return cl;
Show replies by date