This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Add getClassLoader() check for bootstrap classes


Hi,

I added the following test for a change I just checked into GNU
Classpath.

2006-04-06  Mark Wielaard  <mark@klomp.org>

    * gnu/testlet/java/lang/Class/security.java: Add check for no
    permissions when calling getClassLoader() on bootstrap class.

Committed,

Mark
Index: gnu/testlet/java/lang/Class/security.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/lang/Class/security.java,v
retrieving revision 1.3
diff -u -r1.3 security.java
--- gnu/testlet/java/lang/Class/security.java	3 Feb 2006 10:21:46 -0000	1.3
+++ gnu/testlet/java/lang/Class/security.java	6 Apr 2006 13:04:29 -0000
@@ -58,6 +58,8 @@
 	"gnu.testlet.java.lang.Class.");
 
       try {
+	Permission[] noChecks = new Permission[] { };
+
 	Permission[] getClassLoader = new Permission[] {
 	  new RuntimePermission("getClassLoader")};
 
@@ -102,6 +104,18 @@
 	    harness.check(false, "unexpected check");
 	  }
 
+	  // If it is a bootstrap class, there is a null classloader
+	  // and no checks are necessary.
+	  try {
+	    sm.prepareChecks(noChecks);
+	    Thread.class.getClassLoader();
+	    sm.checkAllChecked(harness);
+	  }
+	  catch (SecurityException ex) {
+	    harness.debug(ex);
+	    harness.check(false, "unexpected check");
+	  }
+
 	  // getDeclaredMember checks
 	  getMemberChecks(harness, sm, testClass, true, accessDeclaredMembers);
 	  

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]