< prev index next >

src/java.base/share/classes/sun/net/www/http/HttpClient.java

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

@@ -601,11 +601,11 @@
             // should not be part of the RequestURI. It should be an
             // absolute URI which does not have a fragment part.
             StringBuilder result = new StringBuilder(128);
             result.append(url.getProtocol());
             result.append(":");
-            if (url.getAuthority() != null && url.getAuthority().length() > 0) {
+            if (url.getAuthority() != null && !url.getAuthority().isEmpty()) {
                 result.append("//");
                 result.append(url.getAuthority());
             }
             if (url.getPath() != null) {
                 result.append(url.getPath());

@@ -617,11 +617,11 @@
 
             fileName = result.toString();
         } else {
             fileName = url.getFile();
 
-            if ((fileName == null) || (fileName.length() == 0)) {
+            if ((fileName == null) || (fileName.isEmpty())) {
                 fileName = "/";
             } else if (fileName.charAt(0) == '?') {
                 /* HTTP/1.1 spec says in 5.1.2. about Request-URI:
                  * "Note that the absolute path cannot be empty; if
                  * none is present in the original URI, it MUST be
< prev index next >