Patch: FYI: VMSecurityManager fixlet

Tom Tromey tromey@redhat.com
Tue May 3 22:09:00 GMT 2005


Tom> VMSecurityManager should be calling Class.getSystemClassLoader instead;
Tom> that is what this patch does.

Mark pointed out that this involves a security check, which is bad.
This patch updates the change to use the field from ClassLoader
instead, which has the same effect but avoids the check.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/VMSecurityManager.java (currentClassLoader): Use
	'systemClasssLoader' directly.

Index: java/lang/VMSecurityManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/VMSecurityManager.java,v
retrieving revision 1.5
diff -u -r1.5 VMSecurityManager.java
--- java/lang/VMSecurityManager.java 3 May 2005 19:33:13 -0000 1.5
+++ java/lang/VMSecurityManager.java 3 May 2005 22:07:09 -0000
@@ -54,7 +54,7 @@
     // The docs above are wrong.  See the online docs.
     // FIXME this implementation is a bit wrong too -- the docs say we
     // must also consider ancestors of the system class loader.
-    ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+    ClassLoader systemClassLoader = ClassLoader.systemClassLoader;
     Class[] classStack = getClassContext (caller);
     for (int i = 0; i < classStack.length; i++)
       {



More information about the Java-patches mailing list