src/java.base/share/classes/java/net/InetAddress.java
changeset 53018 8bf9268df0e2
parent 52902 e3398b2e1ab0
child 53133 bf2533105a26
--- a/src/java.base/share/classes/java/net/InetAddress.java	Thu Dec 13 16:14:07 2018 +0100
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Thu Dec 13 15:31:05 2018 +0100
@@ -1187,7 +1187,7 @@
      */
     public static InetAddress getByAddress(String host, byte[] addr)
         throws UnknownHostException {
-        if (host != null && host.length() > 0 && host.charAt(0) == '[') {
+        if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
             if (host.charAt(host.length()-1) == ']') {
                 host = host.substring(1, host.length() -1);
             }
@@ -1301,7 +1301,7 @@
     private static InetAddress[] getAllByName(String host, InetAddress reqAddr)
         throws UnknownHostException {
 
-        if (host == null || host.length() == 0) {
+        if (host == null || host.isEmpty()) {
             InetAddress[] ret = new InetAddress[1];
             ret[0] = impl.loopbackAddress();
             return ret;