[kaffe] Misc. serialization patches

Mark Wielaard mark at klomp.org
Sat Nov 6 06:54:57 PST 2004


On Tue, 2004-11-02 at 19:44, Mattias Rehnberg wrote:
> Guilhem Lavaux <guilhem at kaffe.org> wrote:
> > Thanks. Just one question: I don't remember why we should call 
> > defaultWrite/ReadObject in Vector. The logic behind this call is the 
> > same as if there would not be any write/readObject. BTW, these two 
> > patches concerning the core java library have to go to 
> > classpath at gnu.org.   As they are two lined I don't think you'll need 
> > paperwork. ;)
> Refering to the document at the URL below, 'classdata' will be writen
> on the form 'wrclass objectAnnotation' if it has a write method
> instead of just 'nowrclass'. Since objectAnnotation is a least an
> endBlockData byte, you'll get that byte when you try to deserialize
> the next object in the stream.
> I found this when I tried to deserialize a stream of two Vectors
> written with Sun's Java, the first one deserialized ok, but the second
> one gave me a null reference.
> http://java.sun.com/j2se/1.4.2/docs/guide/serialization/spec/protocol.html

Thanks for the bug report, fix and for forwarding to GNU Classpath. It
seems correct. And making the write method serialized is a good point
since Vector should be thread-safe. But I don't think we need an
explicit read method since there is no other thread trying to manipulate
the Vector at the same time (since the object stream has the only
reference to it). And luckily we don't need it, if we apply the follow
fix from Andrew which went into libgcj a little while ago:

2004-11-06  Andrew Haley  <aph at redhat.com>

        * java/io/ObjectInputStream.java
        (readObject): ENDBLOCKDATA is generated if the class has a write
        method, not if it has a read method.

This makes the mauve test pass even though we removed the readObject()
method. (Without this patch, removing the read method, while a class has
write object, doesn't work correctly). So I have also done that:

2004-11-06  Mark Wielaard  <mark at klomp.org>

        * java/util/Vector.java (readObject): Removed.

Committed to GNU Classpath.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: readObject.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20041106/ab3a4b2a/attachment-0006.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://kaffe.org/pipermail/kaffe/attachments/20041106/ab3a4b2a/attachment-0002.pgp 

More information about the kaffe mailing list