RFR: 7113208: Incorrect javadoc on java.net.DatagramPacket.setLength() [v2]
Jaikiran Pai
jpai at openjdk.org
Thu Sep 1 07:01:17 UTC 2022
On Fri, 26 Aug 2022 10:15:59 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> implement review comment
>
> src/java.base/share/classes/java/net/DatagramPacket.java line 416:
>
>> 414: public synchronized void setLength(int length) {
>> 415: Preconditions.checkFromIndexSize(offset, length, buf.length,
>> 416: Preconditions.outOfBoundsExceptionFormatter(IllegalArgumentException::new));
>
> Thanks for that. Maybe the bound checks in
>
>
> public synchronized void setData(byte[] buf, int offset, int length) {
>
>
> could be replaced in a similar way.
Hello Daniel,
I've now updated this method too to use `Preconditions`. Additionally, a `NullPointerException` check which was implicit in this method (and noted by a code comment) has now been made an explicit check (using `Objects.requireNonNull`) in this updated version. I hope that's OK.
The existing `Setters.java` test case covers this method as well and I've run it after these changes to make sure it continues to pass.
-------------
PR: https://git.openjdk.org/jdk/pull/10037
More information about the net-dev
mailing list