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

Daniel Fuchs dfuchs at openjdk.org
Thu Aug 3 11:42:29 UTC 2023


On Thu, 3 Aug 2023 07:35:10 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which updates the javadoc of `java.net.InetAddress.getCanonicalHostName()` method to clarify its semantics? This addresses https://bugs.openjdk.org/browse/JDK-8313239.
> 
> This a javadoc only change and the documentation is updated to match the current implementation. A CSR will be drafted for this change.

src/java.base/share/classes/java/net/InetAddress.java line 806:

> 804:      *          of the IP address if either the operation is not allowed by the security check
> 805:      *          or the system-wide resolver wasn't able to determine the fully qualified domain
> 806:      *          name for the IP address.

Re-reading this, I wonder if a better wording would be:

Suggestion:

     * @return  the fully qualified domain name for this IP address. 
     *          If either the operation is not allowed by the security check
     *          or the system-wide resolver wasn't able to determine the fully qualified domain
     *          name for the IP address, the textual representation of the IP address is returned instead.


Just a suggestion.

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

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


More information about the net-dev mailing list