< prev index next >

src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java

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

@@ -236,11 +236,11 @@
                                  */
                                 phost =  NetProperties.get(props[i][j]+"Host");
                                 if (phost != null && phost.length() != 0)
                                     break;
                             }
-                            if (phost == null || phost.length() == 0) {
+                            if (phost == null || phost.isEmpty()) {
                                 /**
                                  * No system property defined for that
                                  * protocol. Let's check System Proxy
                                  * settings (Gnome, MacOsX & Windows) if
                                  * we were instructed to.

@@ -265,11 +265,11 @@
                                             nphosts = nprop.defaultVal;
                                         } else {
                                             nprop.hostsSource = null;
                                             nprop.pattern = null;
                                         }
-                                    } else if (nphosts.length() != 0) {
+                                    } else if (!nphosts.isEmpty()) {
                                         // add the required default patterns
                                         // but only if property no set. If it
                                         // is empty, leave empty.
                                         nphosts += "|" + NonProxyInfo
                                                          .defStringVal;
< prev index next >