anuengineer commented on a change in pull request #828: HDDS-1538. Update ozone 
protobuf message for ACLs. Contributed by Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/828#discussion_r285335993
 
 

 ##########
 File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/protocolPB/OMPBHelper.java
 ##########
 @@ -72,24 +81,19 @@ public static OzoneAclInfo convertOzoneAcl(OzoneAcl acl) {
     default:
       throw new IllegalArgumentException("ACL type is not recognized");
     }
-    OzoneAclInfo.OzoneAclRights aclRights;
-    switch(acl.getRights()) {
-    case READ:
-      aclRights = OzoneAclRights.READ;
-      break;
-    case WRITE:
-      aclRights = OzoneAclRights.WRITE;
-      break;
-    case READ_WRITE:
-      aclRights = OzoneAclRights.READ_WRITE;
-      break;
-    default:
-      throw new IllegalArgumentException("ACL right is not recognized");
+    List<OzoneAclRights> aclRights = new ArrayList<>();
+
+    for(ACLType right: acl.getRights()) {
+      try {
+        aclRights.add(OzoneAclRights.valueOf(right.name()));
+      } catch (IllegalArgumentException iae) {
+        LOG.error("ACL:{} right is not recognized.", acl);
 
 Review comment:
   This should be more than a LOG.Error? if we don't recognize an ACL shouldn't 
we return an error to the caller instead of ignoring and continue?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to