Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4502808

premature close of ObjectInputStream causes InternalError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta3
    • generic
    • generic
    • Verified

      In 1.4, if the custom readObject or readExternal method of a serializable
      or externalizable object closes the input stream it is passed as a parameter,
      ObjectInputStream later throws an InternalError. Previous versions of
      serialization allowed reads of such objects to succeed provided that no
      attempts were made to read further data from the stream (after the close).

      ObjectInputStream should be modified to tolerate (potentially multiple)
      premature closes. The other possible fix would be for ObjectInputStream.close()
      to throw an IOException if the close() is attempted inside a custom readObject
      or readExternal method (since close() really shouldn't be called then); however,
      this would appear to be inconsistent with the majority of InputStream subclasses
      out there, which typically do not throw IOExceptions when closed.

      Sample code is attached to this bug report which demonstrates the
      difference in behavior--when run on 1.3.1 and earlier, the sample runs
      to completion; with 1.4, an InternalError is thrown.

            busersunw Btplusnull User (Inactive)
            mwarressunw Michael Warres (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: