RFR: 8313239: InetAddress.getCanonicalHostName may return ip address if reverse lookup fails [v3]
Alan Bateman
alanb at openjdk.org
Thu Aug 3 18:22:31 UTC 2023
On Thu, 3 Aug 2023 12:51:42 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Hello Alan,
>>
>>> I also wonder (and I'm in two minds on this) is if this method should include an impNote to say what it actually does.
>>
>> I'm guessing that you are thinking of having the implNote state that a reverse name lookup will be performed by this method using the system-wide resolver. Right now, the `getHostName()` says this:
>>
>>
>> * <p>If this InetAddress was created with a host name,
>> * this host name will be remembered and returned;
>> * otherwise, a reverse name lookup will be performed
>> * and the result will be returned based on the system
>> * configured resolver. If a lookup of the name service
>> * is required, call
>> * {@link #getCanonicalHostName() getCanonicalHostName}.
>>
>>
>> I think we could update the `getCanonicalName()` to mention the reverse name lookup. However, I'm unsure if it should be an `implNote` or just formal API javadoc.
>
> I have now updated the PR to add a few more details on what this method does and why it might fail.
> I'm guessing that you are thinking of having the implNote state that a reverse name lookup will be performed by this method using the system-wide resolver.
I was thinking more about the caching and attempting the lookup only on first usage. So my comment was wondering out loud if we should note this behavior in an implNote.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15134#discussion_r1283562643
More information about the net-dev
mailing list