RFR: 8306040: HttpResponseInputStream.available() returns 1 on empty stream

Daniel Fuchs dfuchs at openjdk.org
Thu Aug 17 10:45:27 UTC 2023


On Sat, 8 Jul 2023 06:15:13 GMT, Vyom Tewari <vtewari at openjdk.org> wrote:

> Please review the code change for [JDK-8306040](https://bugs.openjdk.org/browse/JDK-8306040). In the overridden "available" method of "HttpResponseInputStream" we are returning 1 after exploring all the code path.

test/jdk/java/net/httpclient/HttpInputStreamAvailableTest.java line 103:

> 101:             // If you use HttpURLConnection, then in.available() will return
> 102:             // different value.
> 103:             assertEquals(ZERO, in.available());

I don't think this assertion makes much sense. If the response contains some data then some might be available already.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14810#discussion_r1297042678


More information about the net-dev mailing list