RFR: JDK-8322141: SequenceInputStream.transferTo should not return as soon as Long.MAX_VALUE bytes have been transferred [v3]

Markus KARG duke at openjdk.org
Sat Dec 16 14:07:56 UTC 2023


On Sat, 16 Dec 2023 08:56:16 GMT, Markus KARG <duke at openjdk.org> wrote:

>> test/jdk/java/io/SequenceInputStream/TransferTo.java line 160:
>> 
>>> 158:                 pos++;
>>> 159:                 return b;
>>> 160:             }
>> 
>> To trigger the problematic case, we need to transfer more than `Long.MAX_VALUE`. `Integer.MAX_VALUE` is not enough, and we need nearly `Integer.MAX_VALUE * Integer.MAX_VALUE` bytes to trigger the problematic case which might take noticeable time.
>> 
>> I think the easiest way would be overriding `transferTo(...)` in a mock `InputStream` so it returns `Long.MAX_VALUE`, and adding that stream in a sequence.
>
> I know and the solution is already in progress (see my last comment from yesterday). Stay tuned.

Done, see https://github.com/openjdk/jdk/pull/17119/commits/556a8dc4d3d8ff157e8374625eb129a08926e0dd. :-)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17119#discussion_r1428818440


More information about the core-libs-dev mailing list