RFR: 8306040: HttpResponseInputStream.available() returns 1 on empty stream
Daniel Fuchs
dfuchs at openjdk.org
Thu Aug 17 13:51:27 UTC 2023
On Thu, 17 Aug 2023 10:42:41 GMT, Daniel Fuchs <dfuchs 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.
If this assertion removed the test passes reliably in the CI. Also note that converting the test to junit would "fix" the issue with the assertion parameters being reversed:
- in testng: assertXxx(actual, expected)
- in junit: assertXxx(expected, actual)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14810#discussion_r1297250675
More information about the net-dev
mailing list