RFR: 8315767: InetAddress: constructing objects from BSD literal addresses [v5]

Sergey Chernyshev schernyshev at openjdk.org
Wed Apr 17 22:23:41 UTC 2024


On Tue, 16 Apr 2024 22:17:21 GMT, Aleksei Efimov <aefimov at openjdk.org> wrote:

>> Sergey Chernyshev has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Update src/java.base/share/classes/java/net/Inet4Address.java
>>    
>>    Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com>
>>  - Update src/java.base/share/classes/java/net/Inet4Address.java
>>    
>>    Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com>
>
> src/java.base/share/classes/sun/net/util/IPAddressUtil.java line 711:
> 
>> 709:                 fieldValue = parseV4FieldBsd(radix, charBuffer, fieldNumber);
>> 710:                 if (fieldValue >= 0) {
>> 711:                     if (fieldValue < 256) {
> 
> Maybe this check can be acccompanied with a comment to clarify the following, ie if a field value is greater than `255` then it can only be the last field. If it is not the last one then `parseV4FieldBsd` enforces this limit and will return `null`.
> That would help future code maintainers :)

done

> test/jdk/java/net/InetAddress/OfLiteralTest.java line 26:
> 
>> 24: /* @test
>> 25:  * @bug 8272215 8315767
>> 26:  * @summary Test for ofLiteral API in InetAddress classes
> 
> The test summary can mention that `ofLiteralPosix` is also tested here

done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18493#discussion_r1569611795
PR Review Comment: https://git.openjdk.org/jdk/pull/18493#discussion_r1569611999


More information about the net-dev mailing list