< prev index next >

src/java.base/share/classes/java/net/InetAddress.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 1185,1195 **** * @exception UnknownHostException if IP address is of illegal length * @since 1.4 */ public static InetAddress getByAddress(String host, byte[] addr) throws UnknownHostException { ! if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) { --- 1185,1195 ---- * @exception UnknownHostException if IP address is of illegal length * @since 1.4 */ public static InetAddress getByAddress(String host, byte[] addr) throws UnknownHostException { ! if (host != null && !host.isEmpty() && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) {
*** 1299,1309 **** } private static InetAddress[] getAllByName(String host, InetAddress reqAddr) throws UnknownHostException { ! if (host == null || host.length() == 0) { InetAddress[] ret = new InetAddress[1]; ret[0] = impl.loopbackAddress(); return ret; } --- 1299,1309 ---- } private static InetAddress[] getAllByName(String host, InetAddress reqAddr) throws UnknownHostException { ! if (host == null || host.isEmpty()) { InetAddress[] ret = new InetAddress[1]; ret[0] = impl.loopbackAddress(); return ret; }
< prev index next >