On Tue, 3 Dec 2024 16:30:27 GMT, Jaikiran Pai <j...@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 > > test/jdk/java/net/InetAddress/OfLiteralTest.java line 381: > >> 379: Arguments.of(InetAddressClass.INET_ADDRESS, ""), >> 380: Arguments.of(InetAddressClass.INET4_ADDRESS, ""), >> 381: Arguments.of(InetAddressClass.INET6_ADDRESS, "") > > Hello Aleksei, could we also add a "blank" literals in this test? Something > like `Arguments.of(..., " ")`? A quick test against current mainline > shows that these implementation correctly throw an `IllegalArgumentException` > for such strings. I think it would be good to have test coverage for those if > we don't already do. Thank you for a good suggestion Jaikiran - I will add tests for blank literals now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22518#discussion_r1868107417