RFR: 8332535: Mark java/nio/channels/DatagramChannel/Loopback.java as intermittent [v3]
SendaoYan
syan at openjdk.org
Wed Jun 26 12:40:42 UTC 2024
On Wed, 26 Jun 2024 11:43:01 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> SendaoYan has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Merge branch 'jbs8332535' of github.com:sendaoYan/jdk-ysd into jbs8332535
>> - add some entropy to the message content and discard any message that we receive whose payload doesn't match what we expect
>
> test/jdk/java/nio/channels/DatagramChannel/Loopback.java line 166:
>
>> 164: dst.clear();
>> 165: continue;
>> 166: }
>
> This is not the correct way to compare two ByteBuffers. ByteBuffer::toString only output things like position, limit, etc.. I suggest using `ByteBuffer::mismatch` instead.
> You will have to `flip` src after line 146 though, since all bytes in src will have been read at that point.
>
> https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/ByteBuffer.html#mismatch(java.nio.ByteBuffer)
Thanks for your patient guidance. The code has been modified accord to your suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19314#discussion_r1654742030
More information about the nio-dev
mailing list