8073213: javadoc of PushbackInputStream methods should specify NullPointerExceptions

Brian Burkhalter brian.burkhalter at oracle.com
Tue Jul 16 16:08:02 UTC 2019


https://bugs.openjdk.java.net/browse/JDK-8073213 <https://bugs.openjdk.java.net/browse/JDK-8073213>

Add javadoc of NPEs missing from two unread() methods; see below.

It would not hurt in this class to also change <code>…</code> to {@code …} and @exception to @throws but that would clutter up the review.

Thanks,

Brian

@@ -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 {


More information about the core-libs-dev mailing list