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

PrintWriter.clearError() to reset internal error state

XMLWordPrintable

    • b59
    • generic
    • generic
    • Verified

      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)
      ======================================================================

            jhangalsunw Jayalaxmi Hangal (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: