RFR: 8299015: Ensure that HttpResponse.BodySubscribers.ofFile writes all bytes [v7]

Jaikiran Pai jpai at openjdk.org
Wed Dec 21 11:24:55 UTC 2022


On Wed, 21 Dec 2022 08:38:37 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

>> The implementation of `BodySubscribers.ofFile` does not correctly handle the case of a short gathering write. The write should be retried until all the bytes have been written to the underlying file.
>> 
>> This is generally not an issue that would occur very frequently, since the `IOV_MAX` is commonly 1024 on Mac/Linux, and 16 on Windows. However, it is clearly a bug, and should be fixed.
>
> Chris Hegarty has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:
> 
>  - Merge branch 'master' into 8299015_http_ofFile
>  - revert and use simple hasRemaining loop
>  - fix catch
>  - retry
>  - another Math.addExact
>  - move into the try
>  - use Math::addExact
>  - review comments: 1) remove MAX_INT restriction, and 2) check 0 write
>  - Initial changes

Hello Chris, these changes look good to me. Please update the copyright years on `Utils.java` and the test class file before integrating.

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

Marked as reviewed by jpai (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11722


More information about the net-dev mailing list