On Tue, 3 Dec 2024 15:52:31 GMT, Aleksei Efimov <aefi...@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 Looks fine but you could additionally add this in InetAddress::ofLiteral: public static InetAddress ofLiteral(String ipAddressLiteral) { Objects.requireNonNull(ipAddressLiteral); + if (ipAddressLiteral.isEmpty()) { + throw IPAddressUtil.invalidIpAddressLiteral(ipAddressLiteral); + } ------------- PR Comment: https://git.openjdk.org/jdk/pull/22518#issuecomment-2515136525