Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-7134. NPE when Ranger client throws RangerServiceException without Status. #3689

Merged
merged 2 commits into from Aug 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -35,6 +35,7 @@
import java.util.stream.Collectors;

import com.google.common.base.Preconditions;
import com.sun.jersey.api.client.ClientResponse;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.OmUtils;
import org.apache.hadoop.ozone.OzoneConsts;
Expand Down Expand Up @@ -148,17 +149,21 @@ public RangerClientMultiTenantAccessController(OzoneConfiguration conf)
* @param rse RangerServiceException
*/
private void decodeRSEStatusCodes(RangerServiceException rse) {

switch (rse.getStatus().getStatusCode()) {
case HTTP_STATUS_CODE_UNAUTHORIZED:
LOG.error("Auth failure. Please double check Ranger-related configs");
break;
case HTTP_STATUS_CODE_BAD_REQUEST:
LOG.error("Request failure. If this is an assign-user operation, "
+ "check if the user name exists in Ranger.");
break;
default:
LOG.error("Other request failure: {}", rse.getStatus());
ClientResponse.Status status = rse.getStatus();
if (status == null) {
LOG.error("Request failure with no status provided.", rse);
} else {
switch (status.getStatusCode()) {
case HTTP_STATUS_CODE_UNAUTHORIZED:
LOG.error("Auth failure. Please double check Ranger-related configs");
break;
case HTTP_STATUS_CODE_BAD_REQUEST:
LOG.error("Request failure. If this is an assign-user operation, "
+ "check if the user name exists in Ranger.");
break;
default:
LOG.error("Other request failure. Status: {}", status);
}
}
}

Expand Down