RMI problems with kaffe 0.10.x

Godmar Back gback at cs.utah.edu
Mon Jun 29 16:50:12 PDT 1998


Nathan, try to following fix to ObjectStreamClass.c.

With it, I was able to successfully run your test program on
a FreeBSD box.

	- Godmar


Index: ObjectStreamClass.c
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/clib/native/ObjectStreamClass.c,v
retrieving revision 1.1
diff -u -r1.1 ObjectStreamClass.c
--- ObjectStreamClass.c	1998/03/31 19:10:54	1.1
+++ ObjectStreamClass.c	1998/06/29 23:48:26
@@ -94,6 +94,7 @@
 {
 	int sz;
 	int i;
+	int cnt;
 	HArrayOfObject* sf;
 	Hjava_io_ObjectStreamField* obj;
 	Field* fld;
@@ -101,9 +102,22 @@
 	char* type;
 
 	sz = CLASS_NIFIELDS(cls);
+	cnt = 0;
+
+	/* count how many non-transient fields there are */
 	fld = CLASS_IFIELDS(cls);
-	sf = (HArrayOfObject*)AllocObjectArray(sz, "Ljava/io/ObjectStreamField;");
 	for (i = 0; i < sz; i++, fld++) {
+		if ((fld->accflags & ACC_TRANSIENT) == 0)
+			cnt++;
+	}
+
+	fld = CLASS_IFIELDS(cls);
+	sf = (HArrayOfObject*)AllocObjectArray(cnt, "Ljava/io/ObjectStreamField;");
+	for (i = 0; i < cnt; fld++) {
+		/* skip transient fields */
+		if (fld->accflags & ACC_TRANSIENT)
+			continue;
+
 		unhand(sf)->body[i] = AllocObject("java/io/ObjectStreamField");
 		obj = (Hjava_io_ObjectStreamField*)unhand(sf)->body[i];
 		unhand(obj)->name = Utf8Const2JavaString(fld->name);
@@ -134,6 +148,7 @@
 			}
 			unhand(obj)->typeString = makeJavaString(buf, strlen(buf));
 		}
+		i++;
 	}
 	return (sf);
 }
@@ -143,10 +158,17 @@
 {
 	Field* fld;
 
+#if 0
+	dprintf("Finding serialversionuid for %s\n", cls->name->data);
+#endif
 	fld = lookupClassField(cls, makeUtf8Const("serialVersionUID" , -1), true);
 	if (fld == 0) {
 		/* return (0); */
-		return (0x1234);
+#if 0
+		dprintf("Class %s does not have a serialVersionUID\n",
+			cls->name->data);
+#endif
+		return (0L);
 	}
 	return (*(jlong*)FIELD_ADDRESS((Field*)fld));
 }


More information about the kaffe mailing list