Hi,

When ClassLoader.defineClass() gets a null ProtectionDomain is should
use the default protection domain. This just moves the  clutch from the
other defineClass() method (that doesn't take a protection domain) into
the one that takes an explicit ProtectionDomain:

2004-11-13  Mark Wielaard  <[EMAIL PROTECTED]>

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

Some of the Eclipse class loaders call defineClass() with a null
ProtectionDomain apparently and you can not store those in a HashTable.

Again, switching to the GNU Classpath ClassLoader implementation might
be a good idea.

Cheers,

Mark
Index: libraries/javalib/java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/ClassLoader.java,v
retrieving revision 1.32
diff -u -r1.32 ClassLoader.java
--- libraries/javalib/java/lang/ClassLoader.java	22 Mar 2004 11:24:46 -0000	1.32
+++ libraries/javalib/java/lang/ClassLoader.java	14 Nov 2004 11:52:24 -0000
@@ -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,13 +173,21 @@
 	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);
 }
 
 protected final Class findLoadedClass(String name) {

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

_______________________________________________
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to