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

Update of the Reader:nullReader() spec for the mark() method

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P2
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      There should be no compatibility issue as this code is new to JDK 11.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      During the analysis of JDK-8204930 it turned out that the specification for the mark method should more align with the Reader's default behavior.

      Solution

      Changing the definition for the mark method to also throw an IOException if the stream has been closed.

      Specification

      Update method specification on java.io.Reader:

          /**
           * Returns a new {@code Reader} that reads no characters. The returned
           * stream is initially open.  The stream is closed by calling the
           * {@code close()} method.  Subsequent calls to {@code close()} have no
           * effect.
           *
           * <p> While the stream is open, the {@code read()}, {@code read(char[])},
           * {@code read(char[], int, int)}, {@code read(Charbuffer)}, {@code
           * ready()}, {@code skip(long)}, and {@code transferTo()} methods all
           * behave as if end of stream has been reached. After the stream has been
           * closed, these methods all throw {@code IOException}.
           *
           * <p> The {@code markSupported()} method returns {@code false}.  The
           * {@code mark()} and {@code reset()} methods throw an {@code IOException}.
           *
           * <p> The {@link #lock object} used to synchronize operations on the
           * returned {@code Reader} is not specified.
           *
           * @return a {@code Reader} which reads no characters
           *
           * @since 11
           */
          public static Reader nullReader() {}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                reinhapa Patrick Reinhart
                Reporter:
                kganapureddy Krushnareddy Ganapureddy
                Reviewed By:
                Brian Burkhalter, Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: