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

SequenceInputStream::read(b, off, 0) throws NPE at EOF when b is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • tbd
    • 19
    • core-libs
    • b23
    • 19

      As per the recent spec amendments per https://bugs.openjdk.java.net/browse/JDK-8286675
      "NullPointerException if the end of the last contained stream has not been reached and b is null."

      Expectation :
      So this clarifies that When last contained stream has been reached and the b is null shall not throw NPE instead it should return -1.

      Actual Behavior :
      When last contained stream has been reached and the b is null throws NPE, To result in expected behavior there is a need for one more invocation of read() before this.

      For complete context, refer the attached sample with has comments.




        1. ReadWithNullAtEOF.java
          2 kB
          Krushnareddy Ganapureddy

            bpb Brian Burkhalter
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: