Repository: incubator-ranger Updated Branches: refs/heads/ranger-0.5 4874016ad -> a451e028e
RANGER-622 Hive plugin - add jar via beeline throws NPE in ranger code Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/a451e028 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/a451e028 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/a451e028 Branch: refs/heads/ranger-0.5 Commit: a451e028e14711fb2fe83103d8eab6f8a6d47f1f Parents: 4874016 Author: Alok Lal <[email protected]> Authored: Thu Aug 20 18:04:35 2015 -0700 Committer: Alok Lal <[email protected]> Committed: Thu Aug 20 19:20:22 2015 -0700 ---------------------------------------------------------------------- .../authorization/hive/authorizer/RangerHiveAuthorizer.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a451e028/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java ---------------------------------------------------------------------- diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java index 9075b57..7aaf8a1 100644 --- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java +++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java @@ -241,6 +241,10 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase { for(HivePrivilegeObject hiveObj : inputHObjs) { RangerHiveResource resource = getHiveResource(hiveOpType, hiveObj); + if (resource == null) { // possible if input object/object is of a kind that we don't currently authorize + continue; + } + if(resource.getObjectType() == HiveObjectType.URI) { String path = hiveObj.getObjectName(); FsAction permission = FsAction.READ; @@ -270,6 +274,10 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase { for(HivePrivilegeObject hiveObj : outputHObjs) { RangerHiveResource resource = getHiveResource(hiveOpType, hiveObj); + if (resource == null) { // possible if input object/object is of a kind that we don't currently authorize + continue; + } + if(resource.getObjectType() == HiveObjectType.URI) { String path = hiveObj.getObjectName(); FsAction permission = FsAction.WRITE;
