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

javadoc of PushbackInputStream methods should specify NullPointerExceptions

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • core-libs
    • None
    • behavioral
    • minimal
    • This change just adds two lines of javadoc so there cannot be a compatibility issue. It is merely clarifying existing behavior.
    • Java API
    • SE

      Summary

      Add javadoc of thrown NullPointerExceptions to the two unread() methods of java.io.PushbackInputStream which accept a byte array parameter.

      Problem

      The methods unread(byte[]) and unread(byte[],int,int) of java.io.PushbackInputStream do not have a throws clause for NullPointerException even though these methods may throw such an exception if the byte array parameter is null.

      Solution

      Add

      @exception NullPointerException If <code>b</code> is <code>null</code>.

      to the javadoc of unread(byte[]) and unread(byte[],int,int).

      Specification

      @@ -213,14 +213,15 @@
           * of the pushback buffer.  After this method returns, the next byte to be
           * read will have the value <code>b[off]</code>, the byte after that will
           * have the value <code>b[off+1]</code>, and so forth.
           *
           * @param b the byte array to push back.
           * @param off the start offset of the data.
           * @param len the number of bytes to push back.
      +     * @exception NullPointerException If <code>b</code> is <code>null</code>.
           * @exception IOException If there is not enough room in the pushback
           *            buffer for the specified number of bytes,
           *            or this input stream has been closed by
           *            invoking its {@link #close()} method.
           * @since     1.1
           */
          public void unread(byte[] b, int off, int len) throws IOException {
      @@ -235,14 +236,15 @@
          /**
           * Pushes back an array of bytes by copying it to the front of the
           * pushback buffer.  After this method returns, the next byte to be read
           * will have the value <code>b[0]</code>, the byte after that will have the
           * value <code>b[1]</code>, and so forth.
           *
           * @param b the byte array to push back
      +     * @exception NullPointerException If <code>b</code> is <code>null</code>.
           * @exception IOException If there is not enough room in the pushback
           *            buffer for the specified number of bytes,
           *            or this input stream has been closed by
           *            invoking its {@link #close()} method.
           * @since     1.1
           */
          public void unread(byte[] b) throws IOException {

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: