8201545: InetAddress.getByName/getAllByName should clarify empty String behavior

Reviewed-by: chegar
This commit is contained in:
Jaikiran Pai 2018-04-30 16:13:30 +01:00 committed by Chris Hegarty
parent 0f478d2cfd
commit 3e47229057
2 changed files with 45 additions and 15 deletions

View file

@ -1222,11 +1222,17 @@ class InetAddress implements java.io.Serializable {
* supported. See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
* scoped addresses.
*
* <p> If the host is {@code null} then an {@code InetAddress}
* representing an address of the loopback interface is returned.
* <p> If the host is {@code null} or {@code host.length()} is equal
* to zero, then an {@code InetAddress} representing an address of the
* loopback interface is returned.
* See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
* section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
* section&nbsp;2.5.3. </p>
* section&nbsp;2.5.3.
*
* <p> If there is a security manager, and {@code host} is not {@code null}
* or {@code host.length() } is not equal to zero, the security manager's
* {@code checkConnect} method is called with the hostname and {@code -1}
* as its arguments to determine if the operation is allowed.
*
* @param host the specified host, or {@code null}.
* @return an IP address for the given host name.
@ -1262,18 +1268,18 @@ class InetAddress implements java.io.Serializable {
* also be qualified by appending a scoped zone identifier or scope_id.
* The syntax and usage of scope_ids is described
* <a href="Inet6Address.html#scoped">here</a>.
* <p> If the host is {@code null} then an {@code InetAddress}
* representing an address of the loopback interface is returned.
*
* <p> If the host is {@code null} or {@code host.length()} is equal
* to zero, then an {@code InetAddress} representing an address of the
* loopback interface is returned.
* See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
* section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
* section&nbsp;2.5.3. </p>
*
* <p> If there is a security manager and {@code host} is not
* null and {@code host.length() } is not equal to zero, the
* security manager's
* {@code checkConnect} method is called
* with the hostname and {@code -1}
* as its arguments to see if the operation is allowed.
* <p> If there is a security manager, and {@code host} is not {@code null}
* or {@code host.length() } is not equal to zero, the security manager's
* {@code checkConnect} method is called with the hostname and {@code -1}
* as its arguments to determine if the operation is allowed.
*
* @param host the name of the host, or {@code null}.
* @return an array of all the IP addresses for a given host name.