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 boolean hasPathCapability(final Path path, final String capability)
throws IOException { throws IOException {
// qualify the path to make sure that it refers to the current FS. // qualify the path to make sure that it refers to the current FS.
final Path p = makeQualified(path); final Path p = makeQualified(path);
if (DfsPathCapabilities.hasPathCapability(p, capability)) { final Boolean cap = DfsPathCapabilities.hasPathCapability(p, capability);
return true; if (cap != null) {
return cap;
} }
// this switch is for features which are in the DFS client but not // this switch is for features which are in the DFS client but not
// (yet/ever) in the WebHDFS API. // (yet/ever) in the WebHDFS API.

View File

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

View File

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