errose28 opened a new pull request #1553: URL: https://github.com/apache/ozone/pull/1553
## What changes were proposed in this pull request? Currently when a user which doesn't have permission to list on a bucket, they get the following message to stderr: ``` $ ozone sh key list o3://ozone1/volume1/bucket1 PERMISSION_DENIED org.apache.hadoop.ozone.om.exceptions.OMException: User <user> doesn't have LIST permission to access bucket ``` The `org.apache.hadoop.ozone.om.exceptions.OMException:` should not be displayed in the error message to make it consistent with other PERMISSION_DENIED messages we get with other commands where we don't have this Exception class shown. ### Cause The `Shell#printError` applies special formatting to `OMException` instances in order to render them as error messages to the user. The `OMException`s generated by ACL failure in list commands, however, are thrown from an `Iterator` interface implementation. This requires the exceptions to be unchecked to not break the interface spec, so methods like `ObjectStore#getNextListOfVolumes` chain any `IOExceptions` (including `OMException`) to a `RuntimeException` before throwing. When `Shell#printError` received this, it determined the exception was not an instance of `OMException`, and used the printing format for all other exception types, which displays the exception name with the message. `Shell#printError` has been updated to check both the derived class and cause of the `Throwable` it receives to determine whether it should convert it to the user error message format or not. ## What is the link to the Apache JIRA HDDS-4431 ## How was this patch tested? Robot acceptance test updated with the expected output for list command on ACL failure. ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
