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

Chris Hegarty chegar at openjdk.org
Tue Dec 20 11:12:54 UTC 2022


On Tue, 20 Dec 2022 10:59:12 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> I don't think we can ever overflow long here; ByteBuffer.remaining can not exceed Integer.MAX_VALUE, and items.toArray cannot create an array with more elements than integer.MAX_VALUE.
>
> Ah! Good point...

True, however Math.addExact is fine here.

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

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


More information about the net-dev mailing list