< prev index next >

src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java

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

@@ -125,12 +125,12 @@
          * per RFC 1738 no hostname is equivalent to 'localhost'
          * i.e. file:///path is equal to file://localhost/path
          */
         String s1 = u1.getHost();
         String s2 = u2.getHost();
-        if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2)))
+        if ("localhost".equalsIgnoreCase(s1) && (s2 == null || s2.isEmpty()))
             return true;
-        if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1)))
+        if ("localhost".equalsIgnoreCase(s2) && (s1 == null || s1.isEmpty()))
             return true;
         return super.hostsEqual(u1, u2);
     }
 }
< prev index next >