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

(spec) SequenceInputStream.read spec does not match impl when byte[] == null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000

      Description



      Name: gm110360 Date: 06/16/2004


      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The javadoc of java.io.SequenceInputStream
      in the method read(byte[], int, int) is :

      // JAVADOC
      public int read(byte[] b,
                      int off,
                      int len)
               throws IOException

          Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until at least 1 byte of input is available. If the first argument is null, up to len bytes are read and discarded.

          The read method of SequenceInputStream tries to read the data from the current substream. If it fails to read any characters because the substream has reached the end of the stream, it calls the close method of the current substream and begins reading from the next substream.
      // ENDJAVADOC

      There is one line which is false :

      "If the first argument is null, up to len bytes are read and discarded."

      It is false and it must be changed because if b is null an NPE is thrown

      --------

      Is it possible to give a List constructor
      and for Tiger to give an args... constructor for multiple inputstream

      --------

      I ask at the same time to something logical to have

      java.io.SequenceReader (which will work the same but for Reader)

      I've done one for myself by taking the source of SequenceInputStream





      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Incident Review ID: 277170)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                iris Iris Clark
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: