RFR: 8332686: InetAddress.ofLiteral can throw StringIndexOutOfBoundsException
Aleksei Efimov
aefimov at openjdk.org
Tue Dec 3 15:58:24 UTC 2024
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
-------------
Commit messages:
- 8332686: InetAddress.ofLiteral can throw StringIndexOutOfBoundsException
Changes: https://git.openjdk.org/jdk/pull/22518/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22518&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8332686
Stats: 12 lines in 2 files changed: 9 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/22518.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22518/head:pull/22518
PR: https://git.openjdk.org/jdk/pull/22518
More information about the net-dev
mailing list