Repository: incubator-ranger
Updated Branches:
  refs/heads/master c659d9aa7 -> 89e11bcc2


RANGER-1161: trie prefilter updated to handle empty resource value


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/89e11bcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/89e11bcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/89e11bcc

Branch: refs/heads/master
Commit: 89e11bcc2a6782dec11f3f88e459dc6aa8691931
Parents: c659d9a
Author: Madhan Neethiraj <mad...@apache.org>
Authored: Fri Sep 2 00:11:17 2016 -0700
Committer: Madhan Neethiraj <mad...@apache.org>
Committed: Fri Sep 2 00:11:17 2016 -0700

----------------------------------------------------------------------
 .../plugin/policyengine/RangerPolicyRepository.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/89e11bcc/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java
----------------------------------------------------------------------
diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java
index 0fd8ed4..51cad3a 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java
@@ -215,7 +215,9 @@ class RangerPolicyRepository {
     }
 
     List<RangerPolicyEvaluator> getPolicyEvaluators(RangerAccessResource 
resource) {
-       return policyResourceTrie == null ? getPolicyEvaluators() : 
getPolicyEvaluators(policyResourceTrie, resource);
+       String resourceStr = resource == null ? null : resource.getAsString();
+
+       return policyResourceTrie == null || StringUtils.isEmpty(resourceStr)  
? getPolicyEvaluators() : getPolicyEvaluators(policyResourceTrie, resource);
     }
 
     List<RangerPolicyEvaluator> getDataMaskPolicyEvaluators() {
@@ -223,7 +225,9 @@ class RangerPolicyRepository {
     }
 
     List<RangerPolicyEvaluator> 
getDataMaskPolicyEvaluators(RangerAccessResource resource) {
-        return dataMaskResourceTrie == null ? getDataMaskPolicyEvaluators() : 
getPolicyEvaluators(dataMaskResourceTrie, resource);
+        String resourceStr = resource == null ? null : resource.getAsString();
+
+        return dataMaskResourceTrie == null || 
StringUtils.isEmpty(resourceStr)  ? getDataMaskPolicyEvaluators() : 
getPolicyEvaluators(dataMaskResourceTrie, resource);
     }
 
     List<RangerPolicyEvaluator> getRowFilterPolicyEvaluators() {
@@ -231,7 +235,9 @@ class RangerPolicyRepository {
     }
 
     List<RangerPolicyEvaluator> 
getRowFilterPolicyEvaluators(RangerAccessResource resource) {
-        return rowFilterResourceTrie == null ? getRowFilterPolicyEvaluators() 
: getPolicyEvaluators(rowFilterResourceTrie, resource);
+        String resourceStr = resource == null ? null : resource.getAsString();
+
+        return rowFilterResourceTrie == null || 
StringUtils.isEmpty(resourceStr)  ? getRowFilterPolicyEvaluators() : 
getPolicyEvaluators(rowFilterResourceTrie, resource);
     }
 
     private List<RangerPolicyEvaluator> getPolicyEvaluators(Map<String, 
RangerResourceTrie> resourceTrie, RangerAccessResource resource) {

Reply via email to