Repository: incubator-ranger Updated Branches: refs/heads/master d79e8566f -> 9bc895321
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/9bc89532 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/9bc89532 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/9bc89532 Branch: refs/heads/master Commit: 9bc895321c3e74bde904e385539c5f0f0c18a288 Parents: d79e856 Author: Alok Lal <[email protected]> Authored: Thu Aug 20 18:04:35 2015 -0700 Committer: Alok Lal <[email protected]> Committed: Thu Aug 20 19:12:26 2015 -0700 ---------------------------------------------------------------------- .../authorization/hive/authorizer/RangerHiveAuthorizer.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/9bc89532/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;
