src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
    56         // if process-wide chdir is allowed or default directory is not the
    56         // if process-wide chdir is allowed or default directory is not the
    57         // process working directory then paths must be resolved against the
    57         // process working directory then paths must be resolved against the
    58         // default directory.
    58         // default directory.
    59         String propValue = GetPropertyAction
    59         String propValue = GetPropertyAction
    60                 .privilegedGetProperty("sun.nio.fs.chdirAllowed", "false");
    60                 .privilegedGetProperty("sun.nio.fs.chdirAllowed", "false");
    61         boolean chdirAllowed = (propValue.length() == 0) ?
    61         boolean chdirAllowed = propValue.isEmpty() ? true : Boolean.parseBoolean(propValue);
    62             true : Boolean.valueOf(propValue);
       
    63         if (chdirAllowed) {
    62         if (chdirAllowed) {
    64             this.needToResolveAgainstDefaultDirectory = true;
    63             this.needToResolveAgainstDefaultDirectory = true;
    65         } else {
    64         } else {
    66             byte[] cwd = UnixNativeDispatcher.getcwd();
    65             byte[] cwd = UnixNativeDispatcher.getcwd();
    67             boolean defaultIsCwd = (cwd.length == defaultDirectory.length);
    66             boolean defaultIsCwd = (cwd.length == defaultDirectory.length);
   267             path = first;
   266             path = first;
   268         } else {
   267         } else {
   269             StringBuilder sb = new StringBuilder();
   268             StringBuilder sb = new StringBuilder();
   270             sb.append(first);
   269             sb.append(first);
   271             for (String segment: more) {
   270             for (String segment: more) {
   272                 if (segment.length() > 0) {
   271                 if (!segment.isEmpty()) {
   273                     if (sb.length() > 0)
   272                     if (sb.length() > 0)
   274                         sb.append('/');
   273                         sb.append('/');
   275                     sb.append(segment);
   274                     sb.append(segment);
   276                 }
   275                 }
   277             }
   276             }