Use Boolean.

This commit is contained in:
Tsz-Wo Nicholas Sze 2023-03-23 22:58:10 +08:00
parent 3698b884e9
commit 5d1d04ca57
3 changed files with 8 additions and 6 deletions

View File

@ -3873,8 +3873,9 @@ public class DistributedFileSystem extends FileSystem
throws IOException {
// qualify the path to make sure that it refers to the current FS.
final Path p = makeQualified(path);
if (DfsPathCapabilities.hasPathCapability(p, capability)) {
return true;
final Boolean cap = DfsPathCapabilities.hasPathCapability(p, capability);
if (cap != null) {
return cap;
}
// this switch is for features which are in the DFS client but not
// (yet/ever) in the WebHDFS API.

View File

@ -36,7 +36,7 @@ public final class DfsPathCapabilities {
* @return either a value to return or, if empty, a cue for the FS to
* pass up to its superclass.
*/
public static boolean hasPathCapability(final Path path,
public static Boolean hasPathCapability(final Path path,
final String capability) {
switch (validatePathCapabilityArgs(path, capability)) {
@ -56,7 +56,7 @@ public final class DfsPathCapabilities {
case CommonPathCapabilities.FS_SYMLINKS:
return FileSystem.areSymlinksEnabled();
default:
return false;
return null;
}
}
}

View File

@ -2206,8 +2206,9 @@ public class WebHdfsFileSystem extends FileSystem
throws IOException {
// qualify the path to make sure that it refers to the current FS.
final Path p = makeQualified(path);
if (DfsPathCapabilities.hasPathCapability(p, capability)) {
return true;
final Boolean cap = DfsPathCapabilities.hasPathCapability(p, capability);
if (cap != null) {
return cap;
}
return super.hasPathCapability(p, capability);
}