[kaffe] CVS kaffe (dalibor): Fixed setting of null value for fields through reflection

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Oct 10 12:04:02 2003


PatchSet 4106 
Date: 2003/10/10 19:01:21
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed setting of null value for fields through reflection

Members: 
	ChangeLog:1.1700->1.1701 
	libraries/javalib/java/lang/reflect/Field.java:1.13->1.14 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1700 kaffe/ChangeLog:1.1701
--- kaffe/ChangeLog:1.1700	Thu Oct  9 20:25:18 2003
+++ kaffe/ChangeLog	Fri Oct 10 19:01:21 2003
@@ -1,3 +1,8 @@
+2003-10-10  Laurent Martelli <laurent@aopsys.com>
+
+	* libraries/javalib/java/lang/reflect/Field.java:
+	(set) Fix NullPointerException wen value is null.
+
 2003-10-09 Milos Negovanovic <milosn@bmf.bounceme.net>
 	* libraries/javalib/gnu/java/io/ClassLoaderObjectInputStream.java,
 	libraries/javalib/gnu/java/lang/ClassHelper.java:
Index: kaffe/libraries/javalib/java/lang/reflect/Field.java
diff -u kaffe/libraries/javalib/java/lang/reflect/Field.java:1.13 kaffe/libraries/javalib/java/lang/reflect/Field.java:1.14
--- kaffe/libraries/javalib/java/lang/reflect/Field.java:1.13	Tue Nov  5 09:42:55 2002
+++ kaffe/libraries/javalib/java/lang/reflect/Field.java	Fri Oct 10 19:01:23 2003
@@ -247,7 +247,7 @@
 		}
 	}
 	else {
-		if (!type.isInstance(value)) {
+		if (value!=null && !type.isInstance(value)) {
 			throw new IllegalArgumentException("field type mismatch: Trying to assign a " + value.getClass().getName() + " to " + toString());
 		}