On Mon, 9 Oct 2023 07:00:08 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> The new APIs are proposing to throw an `IllegalArgumentException` if the > passed literal is not an IP address literal. That seems logical. However, the > existing `getByAddress(byte[] ...)` API which accepts a byte form of the raw > IP address, currently throws `UnknownHostException` in the case where the IP > address isn't of a valid length. Should we consider throwing > `UnknownHostException` from these new APIs too? I prefer > `IllegalArgumentException` in these new APIs, but `UnknownHostException` > might be something that would need to be considered? UHE is an IOException so would be problematic for a number of reasons. IAE is the right exception for bad input here. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1752455199