On Fri, 31 Jul 2026 15:50:46 GMT, Jaikiran Pai <[email protected]> wrote:

>> test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java
>>  line 148:
>> 
>>> 146:             requestBuffer.clear();
>>> 147:             // only send a part of the HTTP request
>>> 148:             int numBytes = RND.nextInt(1, requestBuffer.limit());
>> 
>> Won't this occasionally send the full request?
>
> The second param to `Random.nextInt(...)` is "exclusive". So this call is 
> guaranteed to return at least one byte less than the number of bytes in the 
> `requestText`.

Oh thanks - I got confused, because `numBytes` is set as the new `limit()` and 
the limit is also exclusive. So this guarantees that the new limit will be at 
least 1 less than the old limit so that should be fine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31983#discussion_r3691814920

Reply via email to