On Fri, 15 Dec 2023 18:37:53 GMT, Markus KARG <d...@openjdk.org> wrote:

>> Fixes JDK-8322141
>> 
>> As suggested by @vlsi and documented by @bplb this PR does not return, but 
>> only sets the maximum result value.
>
> Markus KARG has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   New test asserts subsequent input stream is read when preceding stream 
> already was MAX_VALUE long.

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.

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

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

Reply via email to