summaryrefslogtreecommitdiff
path: root/java/io/ObjectInputStream.java
diff options
context:
space:
mode:
authorWarren Levy <warrenl@redhat.com>2000-10-06 00:03:07 +0000
committerWarren Levy <warrenl@redhat.com>2000-10-06 00:03:07 +0000
commita7d8d64aad0a4f47fadd3357a8ce2418691ab073 (patch)
treed3bb4bfc47da39e67d333e51e9b1af9614448ef7 /java/io/ObjectInputStream.java
parent7ad017f4c67a9229ed891327a8107f994198b791 (diff)
downloadclasspath-a7d8d64aad0a4f47fadd3357a8ce2418691ab073.tar.gz
* Makefile.am: Removed Replaceable.java and Resolvable.java.
* ObjectInputStream.java (processResolution): Fixed typo in method name. (processResolution): Handle readResolve method via reflection with removal of Resolvable interface. * ObjectOutputStream.java (writeObject): Handle writeReplace method via reflection with removal of Replaceable interface. * Replaceable.java: Removed. * Resolvable.java: Removed. Serialization mods. Note: The interfaces java.io.Replaceable and java.io.Resolvable were only temporary additions to JDK 1.2 beta versions and were not included in the JDK 1.2 final. The Serialization spec instructs how to deal with their methods (via reflection).
Diffstat (limited to 'java/io/ObjectInputStream.java')
-rw-r--r--java/io/ObjectInputStream.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java
index 7e5e207a5..4e9b26689 100644
--- a/java/io/ObjectInputStream.java
+++ b/java/io/ObjectInputStream.java
@@ -1,5 +1,5 @@
/* ObjectInputStream.java -- Class used to read serialized objects
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,6 +35,9 @@ import java.util.Vector;
import gnu.java.io.ObjectIdentityWrapper;
import gnu.java.lang.reflect.TypeSignature;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
@@ -187,7 +190,7 @@ public class ObjectInputStream extends InputStream
{
// DEBUG ("STRING ");
String s = this.realInputStream.readUTF ();
- ret_val = processResoultion (s, assignNewHandle (s));
+ ret_val = processResolution (s, assignNewHandle (s));
break;
}
@@ -200,7 +203,7 @@ public class ObjectInputStream extends InputStream
Object array = Array.newInstance (componenetType, length);
int handle = assignNewHandle (array);
readArrayElements (array, componenetType);
- ret_val = processResoultion (array, handle);
+ ret_val = processResolution (array, handle);
break;
}
@@ -248,7 +251,7 @@ public class ObjectInputStream extends InputStream
if (read_from_blocks)
setBlockDataMode (false);
- ret_val = processResoultion (obj, handle);
+ ret_val = processResolution (obj, handle);
break;
} // end if (Externalizable.class.isAssignableFrom (clazz))
@@ -313,7 +316,7 @@ public class ObjectInputStream extends InputStream
this.currentObject = null;
this.currentObjectStreamClass = null;
- ret_val = processResoultion (obj, handle);
+ ret_val = processResolution (obj, handle);
break;
}
@@ -935,11 +938,30 @@ public class ObjectInputStream extends InputStream
}
- private Object processResoultion (Object obj, int handle)
+ private Object processResolution (Object obj, int handle)
throws IOException
{
- if (obj instanceof Resolvable)
- obj = ((Resolvable)obj).readResolve ();
+ if (obj instanceof Serializable)
+ {
+ Method m = null;
+ try
+ {
+ Class classArgs[] = {};
+ m = obj.getClass ().getDeclaredMethod ("readResolve", classArgs);
+ // m can't be null by definition since an exception would
+ // have been thrown so a check for null is not needed.
+ obj = m.invoke (obj, new Object[] {});
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+ catch (IllegalAccessException ignore)
+ {
+ }
+ catch (InvocationTargetException ignore)
+ {
+ }
+ }
if (this.resolveEnabled)
obj = resolveObject (obj);