RFR: 8313239: InetAddress.getCanonicalHostName may return ip address if reverse lookup fails [v6]

Jaikiran Pai jpai at openjdk.org
Tue Aug 8 14:31:22 UTC 2023


On Tue, 8 Aug 2023 13:09:55 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Aleksei's review
>
> src/java.base/share/classes/java/net/InetAddress.java line 792:
> 
>> 790:      * {@linkplain InetAddressResolver resolver}.
>> 791:      *
>> 792:      * <p>The system-wide resolver will be used to do a reverse name lookup of the IP address.
> 
> The wording in this paragraph seems a bit different to getHostName and I think we should try to use the same terms in both methods if possible, e.g. getHostName talks about the "system configured resolver" where here it uses "system-wide resolve". We have have "used" vs. "performed". So maybe look at the methods again as I think we should be a bit more consistent with the wording if we can.

Hello Alan, except for a couple of places in `InetAddress` javadoc, the rest of the javadoc (and code comments) in `InetAddress` use the term system-wide resolver instead of system configured resolver. Furthermore, the java.net.spi.InetAddressResolver itself uses the system-wide resolver term. So I've now updated these two places in InetAddress to replace the use of "system configured resolver" to "system-wide resolver".

> src/java.base/share/classes/java/net/InetAddress.java line 796:
> 
>> 794:      * service. In such cases, where the resolver isn't able to determine the fully qualified
>> 795:      * domain name, this method returns the {@linkplain #getHostAddress() textual representation}
>> 796:      * of the IP address.
> 
> I think it would be better to say that the lookup can fail for many reasons that include the host not being registered with the name service. 
> 
> A suggestion for "In such cases .." is to say "f the resolve is unable to determine ...". I think that would be a bit easer to read.

That sounds good. I've updated the PR to use this suggestion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15134#discussion_r1287206805
PR Review Comment: https://git.openjdk.org/jdk/pull/15134#discussion_r1287207810


More information about the net-dev mailing list