RFR: 8332686: InetAddress.ofLiteral can throw StringIndexOutOfBoundsException [v2]

Daniel Fuchs dfuchs at openjdk.org
Tue Dec 3 17:49:42 UTC 2024


On Tue, 3 Dec 2024 17:32:13 GMT, Aleksei Efimov <aefimov at openjdk.org> wrote:

>> The proposed change fixes `InetAddress.ofLiteral` and `Inet6Address.ofLiteral` to throw `IllegalArgumentException` instead of `StringIndexOutOfBoundsException` when an empty IP addres literal string is specified.   
>> The `Inet4Address.ofLiteral` correctly throws `IllegalArgumentException` when a literal cannot be parsed as an IPv4 address literal. It was addressed before in [JDK-8315767](https://bugs.openjdk.org/browse/JDK-8315767) fix.
>> 
>> Testing: the modified `OfLiteralTest` test and other tests from `jdk-tier1` to `jdk-tier3` tiers
>
> Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - IA.ofLiteral - no need to try parsing as IPv4 and IPv6 literal if string is empty.
>  - Add test cases for blank string literals

Marked as reviewed by dfuchs (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/22518#pullrequestreview-2476411820


More information about the net-dev mailing list