JDK-4502808 : premature close of ObjectInputStream causes InternalError
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-09-13
  • Updated: 2002-04-16
  • Resolved: 2001-09-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta3Fixed
Related Reports
Relates :  
Description
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.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta3 FIXED IN: merlin-beta3 INTEGRATED IN: merlin-beta3 VERIFIED IN: merlin-beta3
14-06-2004

EVALUATION For Merlin beta3, ObjectInputStream was fixed to tolerate invocation(s) of close() in the midst of reading an object (as long as no further reads of the underlying stream are required). ###@###.### 2001-09-18
18-09-2001