United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4491255 : PrintWriter.clearError() to reset internal error state

Details
Type:
Enhancement
Submit Date:
2001-08-13
Status:
Closed
Updated Date:
2014-08-12
Project Name:
JDK
Resolved Date:
2005-10-29
Component:
core-libs
OS:
generic
Sub-Component:
java.io
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0,6
Fixed Versions:

Related Reports

Sub Tasks

Description
Name: rmT116609			Date: 08/13/2001


java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

While class java.io.PrintWriter has a checkError() method for retrieving the
internal error flag of the output stream, it does not have any corresponding
method for clearing (resetting) the error flag.

Error conditions are cumulative, with the undesirable consequence that once the
error flag is set, it can never be reset, even if the error condition has been
fixed or ignored as appropriate.

Classes that extend PrintWriter can't clear the error flag either, because the
flag is private.

Adding the following method to java.io.PrintWriter would fill this gap:

    public void clearError();

If this is considered too major a change, the method above could still be added
as a protected method (corresponding to the existing protected setError())
method, so at least classes extending PrintWriter would have a means to clear
the error flag.

--
Related bugs: 4219383
(Review ID: 129842) 
======================================================================

                                    

Comments
EVALUATION

A protected method to clear the error status can be added with a little refinement to the Javadoc in the suggested fix.
                                     
2005-08-05
EVALUATION

A reasonable request.  Will be considered for the next feature release.

-- ###@###.### 2002/4/25
                                     
0191-10-04



Hardware and Software, Engineered to Work Together