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

Haohui Mai commented on HDFS-5932:
----------------------------------

{code}
+    if (aclNotSupportedFsSet.contains(fs.getUri())) {
+      // This FileSystem failed to run the ACL API in an earlier iteration.
+      return false;
+    }
+    try {
+      return !fs.getAclStatus(item.path).getEntries().isEmpty();
+    } catch (RemoteException e) {
+      // If this is a RpcNoSuchMethodException, then the client is connected to
+      // an older NameNode that doesn't support ACLs.  Keep going.
+      IOException e2 = e.unwrapRemoteException(RpcNoSuchMethodException.class);
+      if (!(e2 instanceof RpcNoSuchMethodException)) {
+        throw e;
+      }
+    } catch (IOException e) {
+      // The NameNode supports ACLs, but they are not enabled.  Keep going.
+      String message = e.getMessage();
+      if (message != null && !message.contains("ACLs has been disabled")) {
+        throw e;
+      }
+    } catch (UnsupportedOperationException e) {
+      // The underlying FileSystem doesn't implement ACLs.  Keep going.
+    }
+    // Remember that this FileSystem cannot support ACLs.
+    aclNotSupportedFsSet.add(fs.getUri());
+    return false;
{code}

This method is a little bit confusing. Can you just catch the 
{{RpcNoSuchMethodException}}:

{code}
try {
  getFileStatus();
} catch (RpcNoSuchMethodException) {
  unsupportedFs.add(...);
}
return false;
{code}

I also wonder whether it is possible to cache the fs object directly instead.

Do you want to add a unit test to make sure that ls works as expected when 
{{RpcNoSuchMethodException}} is thrown?

> Ls should display the ACL bit
> -----------------------------
>
>                 Key: HDFS-5932
>                 URL: https://issues.apache.org/jira/browse/HDFS-5932
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs-client, namenode, security
>            Reporter: Haohui Mai
>            Assignee: Chris Nauroth
>         Attachments: HDFS-5932.1.patch, HDFS-5932.2.patch
>
>
> Based on the discussion of HDFS-5923, the ACL bit is no longer passed to the 
> client directly. Ls should call {{getAclStatus()}} instead since it needs to 
> display the ACL bit as a part of the permission.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to