Repository: incubator-impala Updated Branches: refs/heads/master b38d9826d -> 986bc76d5
IMPALA-5530: fix compilation against Sentry * SentryUserException moved packages as a result of the SENTRY-1205 change. If we just catch the Exception superclass Impala should compile against both versions of the API. * SentryPolicyServiceClient.close() throws java.lang.Exception Change-Id: Ie08831dd3df3861f34de75b26eecb9182641aaa9 Reviewed-on: http://gerrit.cloudera.org:8080/7222 Reviewed-by: Thomas Tauber-Marshall <[email protected]> Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Tim Armstrong <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/986bc76d Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/986bc76d Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/986bc76d Branch: refs/heads/master Commit: 986bc76d50ebd5de42bffce41be1c1233082ef57 Parents: b38d982 Author: Tim Armstrong <[email protected]> Authored: Mon Jun 19 09:17:25 2017 -0700 Committer: Tim Armstrong <[email protected]> Committed: Tue Jun 20 02:41:26 2017 +0000 ---------------------------------------------------------------------- .../apache/impala/util/SentryPolicyService.java | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/986bc76d/fe/src/main/java/org/apache/impala/util/SentryPolicyService.java ---------------------------------------------------------------------- diff --git a/fe/src/main/java/org/apache/impala/util/SentryPolicyService.java b/fe/src/main/java/org/apache/impala/util/SentryPolicyService.java index 65a443c..f320cb9 100644 --- a/fe/src/main/java/org/apache/impala/util/SentryPolicyService.java +++ b/fe/src/main/java/org/apache/impala/util/SentryPolicyService.java @@ -19,7 +19,6 @@ package org.apache.impala.util; import java.util.List; -import org.apache.sentry.SentryUserException; import org.apache.sentry.provider.db.SentryAccessDeniedException; import org.apache.sentry.provider.db.SentryAlreadyExistsException; import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient; @@ -78,8 +77,12 @@ public class SentryPolicyService { /** * Returns this client back to the connection pool. Can be called multiple times. */ - public void close() { - client_.close(); + public void close() throws InternalException { + try { + client_.close(); + } catch (Exception e) { + throw new InternalException("Error closing client: ", e); + } } /** @@ -124,7 +127,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "DROP_ROLE")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException("Error dropping role: ", e); } finally { client.close(); @@ -154,7 +157,7 @@ public class SentryPolicyService { } catch (SentryAlreadyExistsException e) { if (ifNotExists) return; throw new InternalException("Error creating role: ", e); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException("Error creating role: ", e); } finally { client.close(); @@ -181,7 +184,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "GRANT_ROLE")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException( "Error making 'grantRoleToGroup' RPC to Sentry Service: ", e); } finally { @@ -210,7 +213,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "REVOKE_ROLE")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException( "Error making 'revokeRoleFromGroup' RPC to Sentry Service: ", e); } finally { @@ -288,7 +291,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "GRANT_PRIVILEGE")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException( "Error making 'grantPrivilege*' RPC to Sentry Service: ", e); } finally { @@ -355,7 +358,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "REVOKE_PRIVILEGE")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException( "Error making 'revokePrivilege*' RPC to Sentry Service: ", e); } finally { @@ -391,7 +394,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "LIST_ROLES")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException("Error making 'listRoles' RPC to Sentry Service: ", e); } finally { client.close(); @@ -410,7 +413,7 @@ public class SentryPolicyService { } catch (SentryAccessDeniedException e) { throw new AuthorizationException(String.format(ACCESS_DENIED_ERROR_MSG, requestingUser.getName(), "LIST_ROLE_PRIVILEGES")); - } catch (SentryUserException e) { + } catch (Exception e) { throw new InternalException("Error making 'listAllPrivilegesByRoleName' RPC to " + "Sentry Service: ", e); } finally {
