RFR: 8306040: HttpResponseInputStream.available() returns 1 on empty stream [v2]
Daniel Fuchs
dfuchs at openjdk.org
Mon Aug 21 08:29:32 UTC 2023
On Fri, 18 Aug 2023 03:40:43 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.
>
> Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision:
>
> converted the test to junit and removed the one assert
Marked as reviewed by dfuchs (Reviewer).
test/jdk/java/net/httpclient/HttpInputStreamAvailableTest.java line 103:
> 101: try ( InputStream in = response.body()) {
> 102: in.readNBytes(2);
> 103: assertEquals(TEST_MESSAGE.length() - 2, in.available());
It could be good to put a comment before this assert to say:
Suggestion:
// this is not guaranteed, but a failure here would be surprising
assertEquals(TEST_MESSAGE.length() - 2, in.available());
-------------
PR Review: https://git.openjdk.org/jdk/pull/14810#pullrequestreview-1586478532
PR Review Comment: https://git.openjdk.org/jdk/pull/14810#discussion_r1299784700
More information about the net-dev
mailing list