[PATCH] TC_CLASS deserialization
Jukka Santala
jsantala at tml.hut.fi
Wed Aug 1 05:12:18 PDT 2001
This short patch should implement TC_CLASS type deserialization from
object-streams, which is required for example with Java Media Framework's
new registry-file loading. It appears to work properly with JMF 2.1.1
registry file at least, altough I'm new to Kaffe internals, hence no
serialization-side (output) support.
-Donwulff
-------------- next part --------------
? kaffe-CLASS.patch
Index: libraries/javalib/kaffe/io/ObjectInputStreamImpl.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/kaffe/io/ObjectInputStreamImpl.java,v
retrieving revision 1.6
diff -u -r1.6 ObjectInputStreamImpl.java
--- libraries/javalib/kaffe/io/ObjectInputStreamImpl.java 2000/06/15 16:08:54 1.6
+++ libraries/javalib/kaffe/io/ObjectInputStreamImpl.java 2001/08/01 11:55:24
@@ -166,6 +166,10 @@
currObject = getArray();
break;
+ case ObjectStreamConstants.TC_CLASS:
+ currObject = getClassOnly();
+ break;
+
case ObjectStreamConstants.TC_RESET:
resetObjectReferences();
return (readObject());
@@ -236,6 +240,26 @@
try {
ObjectStreamClassImpl cls = (ObjectStreamClassImpl)parent.readObject();
Object obj = cls.getObject(parent, this);
+ return (obj);
+ }
+ catch (InvalidClassException ice) {
+ throw ice;
+ }
+ catch (ClassNotFoundException e1) {
+ throw new StreamCorruptedException("error getting object: " + e1);
+ }
+ catch (IOException e2) {
+ throw new StreamCorruptedException("error getting object: " + e2);
+ }
+ catch (ClassCastException e3) {
+ throw new StreamCorruptedException("error getting object: " + e3);
+ }
+}
+
+private Object getClassOnly() throws StreamCorruptedException, OptionalDataException, InvalidClassException {
+ try {
+ Object obj = (ObjectStreamClassImpl)parent.readObject();
+ makeObjectReference(obj);
return (obj);
}
catch (InvalidClassException ice) {
More information about the kaffe
mailing list