On Mon, 10 Nov 2025 17:29:27 GMT, Daniel Fuchs <[email protected]> wrote:

>> src/java.base/share/classes/java/net/HostPortrange.java line 65:
>> 
>>> 63:         // Defensive validation first
>>> 64:         if (host == null || host.isEmpty()) {
>>> 65:             throw new IllegalArgumentException("empty authority");
>> 
>> Hello Oumaiyma, the change overall looks OK to me. However, this error 
>> message and the other one feel a bit odd. The variable is called `host` and 
>> we throw an "empty authority" here whereas the other place, the variable is 
>> called "authority" and we throw a error message which says "empty host". 
>> 
>> @dfuch do you suggest we switch these error messages?
>
> We should probably throw the same exception here than below:
> 
> 
> throw new IllegalArgumentException("Invalid URL authority: empty host");
> 
> 
> If the authority is empty the host is a fortiori empty too.

Technically (and as one of the test cases shows) the authority might not be 
empty, but the "host port" part is empty. I think "Invalid URL authority" might 
be okay though.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27896#discussion_r2513634883

Reply via email to