[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: serialization fixes

Kaffe CVS cvs-commits at kaffe.org
Sat Jan 22 10:37:15 PST 2005


PatchSet 5884 
Date: 2005/01/22 18:21:39
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: serialization fixes

2005-01-22  Dalibor Topic  <robilad at kaffe.org>

Resynced with GNU Classpath.

2005-01-18  Mark Wielaard  <mark at klomp.org>

Fixes bug #11618.
* java/io/ObjectInputStream.java (readClassDescriptor): Handle classes
without a super class and us ObjectStreamClass.lookupForClassObject().
(resolveClass): Check for primitive types.
(lookupClass): Return null when argument is null.

Members: 
	ChangeLog:1.3425->1.3426 
	libraries/javalib/java/io/ObjectInputStream.java:1.46->1.47 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3425 kaffe/ChangeLog:1.3426
--- kaffe/ChangeLog:1.3425	Sat Jan 22 18:04:52 2005
+++ kaffe/ChangeLog	Sat Jan 22 18:21:39 2005
@@ -2,6 +2,49 @@
 
 	Resynced with GNU Classpath.
 	
+	2005-01-19  Graydon Hoare  <graydon at redhat.com>
+
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:
+	Rewrite uses of extern variable to be function calls.
+	* native/jni/gtk-peer/gtkpeer.h (gdk_env): Change declaration to
+	function, from extern variable.
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+	(gdk_env): Remove variable, add new function.
+	(java_vm): Add new variable.
+	(Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Initialize
+	java_vm rather than old gdk_env variable.
+	
+2005-01-22  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
+	2005-01-18  Mark Wielaard  <mark at klomp.org>
+
+	Fixes bug #11618.
+	* java/io/ObjectInputStream.java (readClassDescriptor): Handle classes
+	without a super class and us ObjectStreamClass.lookupForClassObject().
+	(resolveClass): Check for primitive types.
+	(lookupClass): Return null when argument is null.
+
+2005-01-22  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
 	2005-01-19  Andrew John Hughes  <gnu_andrew at member.fsf.org>
 
 	Merge of java.lang.Appendable to HEAD from
Index: kaffe/libraries/javalib/java/io/ObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.46 kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.47
--- kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.46	Wed Dec  8 16:51:55 2004
+++ kaffe/libraries/javalib/java/io/ObjectInputStream.java	Sat Jan 22 18:21:56 2005
@@ -1,5 +1,6 @@
 /* ObjectInputStream.java -- Class used to read serialized objects
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -536,8 +537,14 @@
     // find the first non-serializable, non-abstract
     // class in clazz's inheritance hierarchy
     Class first_nonserial = clazz.getSuperclass();
-    while (Serializable.class.isAssignableFrom(first_nonserial)
-	|| Modifier.isAbstract(first_nonserial.getModifiers()))
+    // Maybe it is a primitive class, those don't have a super class,
+    // or Object itself.  Otherwise we can keep getting the superclass
+    // till we hit the Object class, or some other non-serializable class.
+    if (first_nonserial == null)
+      first_nonserial = clazz;
+    else
+      while (Serializable.class.isAssignableFrom(first_nonserial)
+	     || Modifier.isAbstract(first_nonserial.getModifiers()))
 	first_nonserial = first_nonserial.getSuperclass();
 
     final Class local_constructor_class = first_nonserial;
@@ -567,7 +574,7 @@
     osc.realClassIsExternalizable = Externalizable.class.isAssignableFrom(clazz);
 
     ObjectStreamField[] stream_fields = osc.fields;
-    ObjectStreamField[] real_fields = ObjectStreamClass.lookup(clazz).fields;
+    ObjectStreamField[] real_fields = ObjectStreamClass.lookupForClassObject(clazz).fields;
     ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)];
 
     int stream_idx = 0;
@@ -733,7 +740,37 @@
   protected Class resolveClass(ObjectStreamClass osc)
     throws ClassNotFoundException, IOException
   {
-    return Class.forName(osc.getName(), true, currentLoader());
+    try
+      {
+	return Class.forName(osc.getName(), true, currentLoader());
+      }
+    catch (ClassNotFoundException cnfe)
+      {
+	// Maybe it was an primitive class?
+	String name = osc.getName();
+	if (name.equals("void"))
+	  return Void.TYPE;
+	if (name.equals("boolean"))
+	  return Boolean.TYPE;
+	if (name.equals("byte"))
+	  return Byte.TYPE;
+	if (name.equals("short"))
+	  return Short.TYPE;
+	if (name.equals("char"))
+	  return Character.TYPE;
+	if (name.equals("int"))
+	  return Integer.TYPE;
+	if (name.equals("long"))
+	  return Long.TYPE;
+	if (name.equals("float"))
+	  return Float.TYPE;
+	if (name.equals("double"))
+	  return Double.TYPE;
+	if (name.equals("void"))
+	  return Void.TYPE;
+
+	throw cnfe;
+      }
   }
 
   /**
@@ -766,8 +803,10 @@
    */
   private ObjectStreamClass lookupClass(Class clazz)
   {
-    ObjectStreamClass oclazz;
+    if (clazz == null)
+      return null;
 
+    ObjectStreamClass oclazz;
     oclazz = (ObjectStreamClass)classLookupTable.get(clazz);
     if (oclazz == null)
       return ObjectStreamClass.lookup(clazz);




More information about the kaffe mailing list