@@ -731,8 +731,8 @@ public boolean isReachable(NetworkInterface netif, int ttl,
731
731
* <p>If this InetAddress was created with a host name,
732
732
* this host name will be remembered and returned;
733
733
* otherwise, a reverse name lookup will be performed
734
- * and the result will be returned based on the system
735
- * configured resolver. If a lookup of the name service
734
+ * and the result will be returned based on the system-wide
735
+ * resolver. If a lookup of the name service
736
736
* is required, call
737
737
* {@link #getCanonicalHostName() getCanonicalHostName}.
738
738
*
@@ -785,9 +785,15 @@ String getHostName(boolean check) {
785
785
}
786
786
787
787
/**
788
- * Gets the fully qualified domain name for this IP address.
789
- * Best effort method, meaning we may not be able to return
790
- * the FQDN depending on the underlying system configuration.
788
+ * Gets the fully qualified domain name for this
789
+ * {@linkplain InetAddress#getAddress() IP address} using the system-wide
790
+ * {@linkplain InetAddressResolver resolver}.
791
+ *
792
+ * <p>The system-wide resolver will be used to do a reverse name lookup of the IP address.
793
+ * The lookup can fail for many reasons that include the host not being registered with the name
794
+ * service. If the resolver is unable to determine the fully qualified
795
+ * domain name, this method returns the {@linkplain #getHostAddress() textual representation}
796
+ * of the IP address.
791
797
*
792
798
* <p>If there is a security manager, this method first
793
799
* calls its {@code checkConnect} method
@@ -797,9 +803,11 @@ String getHostName(boolean check) {
797
803
* If the operation is not allowed, it will return
798
804
* the textual representation of the IP address.
799
805
*
800
- * @return the fully qualified domain name for this IP address,
801
- * or if the operation is not allowed by the security check,
802
- * the textual representation of the IP address.
806
+ * @return the fully qualified domain name for this IP address.
807
+ * If either the operation is not allowed by the security check
808
+ * or the system-wide resolver wasn't able to determine the
809
+ * fully qualified domain name for the IP address, the textual
810
+ * representation of the IP address is returned instead.
803
811
*
804
812
* @see SecurityManager#checkConnect
805
813
*
@@ -814,22 +822,24 @@ public String getCanonicalHostName() {
814
822
}
815
823
816
824
/**
817
- * Returns the hostname for this address.
825
+ * Returns the fully qualified domain name for the given address.
818
826
*
819
827
* <p>If there is a security manager, this method first
820
828
* calls its {@code checkConnect} method
821
829
* with the hostname and {@code -1}
822
830
* as its arguments to see if the calling code is allowed to know
823
- * the hostname for this IP address, i.e., to connect to the host.
831
+ * the hostname for the given IP address, i.e., to connect to the host.
824
832
* If the operation is not allowed, it will return
825
833
* the textual representation of the IP address.
826
834
*
827
- * @return the host name for this IP address, or if the operation
828
- * is not allowed by the security check, the textual
829
- * representation of the IP address.
830
- *
831
835
* @param check make security check if true
832
836
*
837
+ * @return the fully qualified domain name for the given IP address.
838
+ * If either the operation is not allowed by the security check
839
+ * or the system-wide resolver wasn't able to determine the
840
+ * fully qualified domain name for the IP address, the textual
841
+ * representation of the IP address is returned instead.
842
+ *
833
843
* @see SecurityManager#checkConnect
834
844
*/
835
845
private static String getHostFromNameService (InetAddress addr , boolean check ) {
@@ -1570,7 +1580,7 @@ public static InetAddress getByName(String host)
1570
1580
1571
1581
/**
1572
1582
* Given the name of a host, returns an array of its IP addresses,
1573
- * based on the configured system {@linkplain InetAddressResolver resolver}.
1583
+ * based on the system-wide {@linkplain InetAddressResolver resolver}.
1574
1584
*
1575
1585
* <p> The host name can either be a machine name, such as
1576
1586
* "{@code www.example.com}", or a textual representation of its IP
0 commit comments