RFR: 8264200: java/nio/channels/DatagramChannel/SRTest.java fails intermittently [v3]
Conor Cleary
ccleary at openjdk.java.net
Tue Apr 6 19:41:32 UTC 2021
On Tue, 6 Apr 2021 18:57:37 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Conor Cleary has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - 8264200: Remove duplicate send invocations
>> - 8264200: Construct String with data offset/length
>
> test/jdk/java/nio/channels/DatagramChannel/SRTest.java line 191:
>
>> 189: DatagramPacket dp = new DatagramPacket(buf, buf.length);
>> 190: ds.receive(dp);
>> 191: String received = new String(dp.getData(), 0, DATA_STRING.length(), US_ASCII);
>
> That's not quite correct either. The `DatagramPacket` should have its length and offset positioned correctly after `receive` - that's the values you should use (`p.getOffset()`, `p.getLength()`).
Ah ok understood, I can see that is more correct now. Will change shortly
-------------
PR: https://git.openjdk.java.net/jdk/pull/3354
More information about the nio-dev
mailing list