Marshalling a Serializable object (let's call it A) that has a reference to another Serializable object that overrides readObject(ObjectInputStream) (let's call this second object B) fails when A has other fields other than the reference to B and these fields are serialized after B. In JBMAR, this can be forced by making sure these other fields start with letters alphabetically next than the field reference to B.
I've just committed a failing test to JBMAR trunk (SimpleMarshallerTests.testSerializableThatReferencesSerializableOverridenReadObjec).
The exception thrown is:
FAILED: testSerializableThatReferencesSerializableOverridenReadObject
java.io.EOFException: Read past end of file
at org.jboss.marshalling.AbstractUnmarshaller.eofOnRead(AbstractUnmarshaller.java:180)
at org.jboss.marshalling.AbstractUnmarshaller.readUnsignedByteDirect(AbstractUnmarshaller.java:308)
at org.jboss.marshalling.AbstractUnmarshaller.readUnsignedByte(AbstractUnmarshaller.java:276)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:158)
at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:81)
at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1562)
at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1471)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1119)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:221)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:158)
at org.jboss.marshalling.AbstractUnmarshaller.readObject(AbstractUnmarshaller.java:81)
at org.jboss.test.marshalling.SimpleMarshallerTests$9.runRead(SimpleMarshallerTests.java:380)
at org.jboss.test.marshalling.TestBase.runReadWriteTest(TestBase.java:120)
at org.jboss.test.marshalling.SimpleMarshallerTests.testSerializableThatReferencesSerializableOverridenReadObject(SimpleMarshallerTests.java:374)
... Removed 22 stack frames