[ 
https://issues.apache.org/jira/browse/HDFS-16963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17704605#comment-17704605
 ] 

ASF GitHub Bot commented on HDFS-16963:
---------------------------------------

szetszwo commented on code in PR #5505:
URL: https://github.com/apache/hadoop/pull/5505#discussion_r1147590981


##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java:
##########
@@ -3876,10 +3873,9 @@ public boolean hasPathCapability(final Path path, final 
String capability)
       throws IOException {
     // qualify the path to make sure that it refers to the current FS.
     final Path p = makeQualified(path);
-    Optional<Boolean> cap = DfsPathCapabilities.hasPathCapability(p,
-        capability);
-    if (cap.isPresent()) {
-      return cap.get();
+    if (DfsPathCapabilities.hasPathCapability(p, capability)
+        && supportsSymlinks()) {

Review Comment:
   In 
https://github.com/szetszwo/hadoop/commit/6ddc4f245b2f234bc5da5b3f02c1882ecc5fdaec
 , line 62 `supportsSymlinks()` returns false but line 64 
`dfs.hasPathCapability(..)` still returns true.





> Remove the unnecessary use of Optional from DistributedFileSystem
> -----------------------------------------------------------------
>
>                 Key: HDFS-16963
>                 URL: https://issues.apache.org/jira/browse/HDFS-16963
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: fs
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>              Labels: pull-request-available
>
> - In DfsPathCapabilities, the hasPathCapability(..) method may simply returns 
> boolean.
>  - In HdfsPathHandle, a constructor declares Optional parameters. It is a 
> well known misuse of Optional.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to