[kaffe] CVS kaffe (robilad): Made defineClass work with null ProtectionDomain

Kaffe CVS cvs-commits at kaffe.org
Sun Nov 14 09:11:21 PST 2004


PatchSet 5456 
Date: 2004/11/14 17:07:20
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Made defineClass work with null ProtectionDomain

2004-11-13  Mark Wielaard  <mark at klomp.org>

        * libraries/javalib/java/lang/ClassLoader.java
        (defineClass(String,byte[],int,int)): Move
        defaultProtectionDomain initialization to...
        (defineClass(String,byte[],int,int,ProtectionDomain)): ...here.

Members: 
	ChangeLog:1.3002->1.3003 
	libraries/javalib/java/lang/ClassLoader.java:1.32->1.33 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3002 kaffe/ChangeLog:1.3003
--- kaffe/ChangeLog:1.3002	Sun Nov 14 13:52:03 2004
+++ kaffe/ChangeLog	Sun Nov 14 17:07:20 2004
@@ -1,5 +1,12 @@
 2004-11-13  Mark Wielaard  <mark at klomp.org>
 
+        * libraries/javalib/java/lang/ClassLoader.java
+        (defineClass(String,byte[],int,int)): Move
+        defaultProtectionDomain initialization to...
+        (defineClass(String,byte[],int,int,ProtectionDomain)): ...here.
+
+2004-11-13  Mark Wielaard  <mark at klomp.org>
+
         * include/errors.h
         (ArrayStoreException): Define to take a message.
         * kaffe/kaffevm/soft.c
Index: kaffe/libraries/javalib/java/lang/ClassLoader.java
diff -u kaffe/libraries/javalib/java/lang/ClassLoader.java:1.32 kaffe/libraries/javalib/java/lang/ClassLoader.java:1.33
--- kaffe/libraries/javalib/java/lang/ClassLoader.java:1.32	Mon Mar 22 11:24:46 2004
+++ kaffe/libraries/javalib/java/lang/ClassLoader.java	Sun Nov 14 17:07:22 2004
@@ -165,11 +165,7 @@
 
 protected final Class defineClass(String name, byte data[], int off, int len)
 		throws ClassFormatError {
-	if (defaultProtectionDomain == null) {
-		// XXX FIXME..
-		defaultProtectionDomain = new ProtectionDomain(null, null);
-	}
-	return defineClass(name, data, off, len, defaultProtectionDomain);
+	return defineClass(name, data, off, len, null);
 }
 
 protected final Class defineClass(String name, byte data[], int off,
@@ -177,12 +173,20 @@
 	if (off < 0 || len < 0 || off + len > data.length) {
 		throw new IndexOutOfBoundsException();
 	}
-	Class clazz = defineClass0(name, data, off, len);
+	Class clazz = null;
+	clazz = defineClass0(name, data, off, len);
 	if (name != null) {
 		loadedClasses.put(name, clazz);
 	}
 	else {
 		loadedClasses.put(clazz.getName(), clazz);
+	}
+	if (pd == null) {
+		if (defaultProtectionDomain == null) {
+			// XXX FIXME..
+			defaultProtectionDomain = new ProtectionDomain(null, null);
+		}
+		pd = defaultProtectionDomain;
 	}
 	protectionDomains.put(clazz, pd);
 	return (clazz);



More information about the kaffe mailing list