< prev index next >

src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java

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

@@ -56,12 +56,11 @@
         // if process-wide chdir is allowed or default directory is not the
         // process working directory then paths must be resolved against the
         // default directory.
         String propValue = GetPropertyAction
                 .privilegedGetProperty("sun.nio.fs.chdirAllowed", "false");
-        boolean chdirAllowed = (propValue.length() == 0) ?
-            true : Boolean.valueOf(propValue);
+        boolean chdirAllowed = propValue.isEmpty() ? true : Boolean.parseBoolean(propValue);
         if (chdirAllowed) {
             this.needToResolveAgainstDefaultDirectory = true;
         } else {
             byte[] cwd = UnixNativeDispatcher.getcwd();
             boolean defaultIsCwd = (cwd.length == defaultDirectory.length);

@@ -267,11 +266,11 @@
             path = first;
         } else {
             StringBuilder sb = new StringBuilder();
             sb.append(first);
             for (String segment: more) {
-                if (segment.length() > 0) {
+                if (!segment.isEmpty()) {
                     if (sb.length() > 0)
                         sb.append('/');
                     sb.append(segment);
                 }
             }
< prev index next >