Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-98

Problem with Serializable readObject() with no matching writeObject()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.2.1.GA, 1.3.0.CR1
    • None
    • Serial
    • None
    • Medium

    Description

      Consider Serializable class A with the following properties:

      • a readObject() method
      • no writeObject() method
      • readObject()'s first action is ois.defaultReadFields()

      Since there is no writeObject() method, serial.PlainDescriptor.readSerial() marks an end of stream on the BlockUnmarshaller (and thus the ObjectInputStream) so that if/when readObject() tries to read bytes from the write side's nonexistant writeObject() method, it will read an EOF (-1) instead, to preserve forward compatibility between object versions.

      However, this means that when readObject() calls ois.defaultReadFields(), the block input is in the wrong state and reading fields fails, usually with an unexpected TC_ENDBLOCKDATA.

      Attachments

        Activity

          People

            dlloyd@redhat.com David Lloyd
            dlloyd@redhat.com David Lloyd
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: