McKoi db error

Tom Tromey tromey@redhat.com
Sun Mar 23 04:18:00 GMT 2003


>>>>> "Geert" == Geert Bevin <gbevin@uwyn.com> writes:

Geert> Dman, attached the wrong version :-/ Take this one instead. Sorry for
Geert> the confusion.

I stepped through this a bit in the debugger.

Here is what I think to be the relevant code in ObjectOutputStream:

		    if (currentObjectStreamClass.hasWriteMethod ())
		      {
			setBlockDataMode (true);
			callWriteMethod (obj, currentObjectStreamClass);
			setBlockDataMode (false);
			realOutput.writeByte (TC_ENDBLOCKDATA);
		      }
		    else
		      writeFields (obj, currentObjectStreamClass);

In your example, the Expr.writeObject method basically boils down to
a call to writeFields().

I don't understand why the two branches differ.  Maybe Mark can say.
why does the `hasWriteMethod' branch set block data mode and write the
TC_ENDBLOCKDATA byte?

One thing worth investigating is how libgcj and the JDK differ for
your example.  In particular its worth looking at the actual generated
bits.

You can find a grammar here:

http://java.sun.com/j2se/1.4/docs/guide/serialization/spec/protocol.doc5.html

I'm too tired to decode it right now.
I suspect the fields must always be followed by TC_ENDBLOCKDATA.

Note that any bug fix here must be accompanied by a test, preferably
in Mauve.  We need to raise our standards a bit in the testing area.
We also need to be a bit more aware of serialization; ideally we'd
have serialization interoperability tests in Mauve.

Tom



More information about the Java mailing list