HDFS-14890. Fixed namenode and journalnode startup on Windows.

Contributed by Siddharth Wagle

(cherry picked from commit aa24add8f0)
This commit is contained in:
Eric Yang 2019-10-04 13:13:10 -04:00
parent 673c9d53ca
commit 8bb2b00d38
1 changed files with 8 additions and 3 deletions

View File

@ -447,9 +447,14 @@ public abstract class Storage extends StorageInfo {
throw new IOException("Cannot create directory " + curDir);
}
if (permission != null) {
Set<PosixFilePermission> permissions =
PosixFilePermissions.fromString(permission.toString());
Files.setPosixFilePermissions(curDir.toPath(), permissions);
try {
Set<PosixFilePermission> permissions =
PosixFilePermissions.fromString(permission.toString());
Files.setPosixFilePermissions(curDir.toPath(), permissions);
} catch (UnsupportedOperationException uoe) {
// Default to FileUtil for non posix file systems
FileUtil.setPermission(curDir, permission);
}
}
}