JDK-4171233 : java.io.PushbackInputStream should override mark and reset methods
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: core-libs
  • Sub-Component: java.io
  • Priority: P4
  • Affected Version: 1.2.0
  • OS: solaris_2.5.1
  • CPU: generic
  • Submit Date: 1998-09-03
  • Updated Date: 2017-05-16
  • Resolved Date: 2003-05-16
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 Availabitlity Release.

To download the current JDK release, click here.
5.0 tigerResolved
Related Reports
Relates :  
	The PushbackInputStream class overrides markSupported() to
return false. For consistency with other java.io.* classes it should also
override mark() to be a NOP and reset() to throw an IOException with
a reason string saying that mark/reset are not supported.

Currently, mark() and reset() are not overridden and so are inherited from
FilterInputStream which delegates them to the next InputStream which may well
actually implement mark/reset and result in inconsistent and unexpected
behavior when using the pushbackInputStream.

Although developers should really call
mark() and reset() on a stream only if markSupported() returns true
the current behavior in pushbackInputStream is inconsistent from other
java.io.* classes which override all 3 methods together and could results in odd
and confusing behavior that may be difficult to debug.

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b07

SUGGESTED FIX PushbackInputStream should implement a NOP mark() method and a reset() method which throws an IOException.

PUBLIC COMMENTS PushbackInputStream should consistently override mark() and reset() in addition to markSupported().

EVALUATION PushbackInputStream subvertly goes ahead and actually marks and resets the underlying stream (potentially incorrectly) even though it clearly professes that it does'nt support the mark/reset mechanism. The suggested fix will be put in Kestrel FCS. naveen.sanjeeva@eng 1999-09-14 Reopened bug, since CCC decided that Kestrel FCS was too late to introduce this fix. naveen.sanjeeva@eng 1999-10-15 Have done as the description suggests in Tiger. ###@###.### 2003-04-23