Repository: incubator-sentry Updated Branches: refs/heads/master 128a23401 -> 805a1c988
SENTRY-466: Return failure code when SentryClient was not successfully instantiated (Sravya Tirukkovalur via Prasad Mujumdar) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/805a1c98 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/805a1c98 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/805a1c98 Branch: refs/heads/master Commit: 805a1c988d95597185c36be7f7f3adcc94395f84 Parents: 128a234 Author: Prasad Mujumdar <[email protected]> Authored: Tue Sep 23 18:33:07 2014 -0700 Committer: Prasad Mujumdar <[email protected]> Committed: Tue Sep 23 18:33:07 2014 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/805a1c98/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java index fb5ff14..6f33109 100644 --- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java +++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/hadoop/hive/ql/exec/SentryGrantRevokeTask.java @@ -127,7 +127,6 @@ public class SentryGrantRevokeTask extends Task<DDLWork> implements Serializable this.sentryClient = sentryClientFactory.create(authzConf); } catch (Exception e) { String msg = "Error creating Sentry client: " + e.getMessage(); - LOG.error(msg, e); throw new RuntimeException(msg, e); } Preconditions.checkNotNull(hiveAuthzBinding, "HiveAuthzBinding cannot be null"); @@ -176,6 +175,12 @@ public class SentryGrantRevokeTask extends Task<DDLWork> implements Serializable LOG.error(msg, e); console.printError(msg); return RETURN_CODE_FAILURE; + } catch(Throwable e) { + setException(e); + String msg = "Error processing Sentry command: " + e.getMessage(); + LOG.error(msg, e); + console.printError(msg); + return RETURN_CODE_FAILURE; } finally { if (sentryClient != null) { sentryClient.close();
