< prev index next >

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

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -435,11 +435,11 @@
     protected synchronized InetAddress getHostAddress(URL u) {
         if (u.hostAddress != null)
             return u.hostAddress;
 
         String host = u.getHost();
-        if (host == null || host.equals("")) {
+        if (host == null || host.isEmpty()) {
             return null;
         } else {
             try {
                 u.hostAddress = InetAddress.getByName(host);
             } catch (UnknownHostException ex) {
< prev index next >