You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2022/09/14 19:56:01 UTC

[ranger] branch ranger-2.4 updated: RANGER-3911: NPE fix in RangerDefaultPolicyEvaluator

This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.4 by this push:
     new 2ee1bb6f5 RANGER-3911: NPE fix in RangerDefaultPolicyEvaluator
2ee1bb6f5 is described below

commit 2ee1bb6f57661c25175ee85af8e1e37dbb9759cb
Author: pradeep <pr...@apache.org>
AuthorDate: Wed Sep 14 19:17:30 2022 +0530

    RANGER-3911: NPE fix in RangerDefaultPolicyEvaluator
---
 .../src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java      | 2 +-
 .../ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
index 51c28e3f3..095fc9abf 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
@@ -1381,7 +1381,7 @@ public class RangerPolicy extends RangerBaseModelObject implements java.io.Seria
 		 * @param type the type to set
 		 */
 		public void setType(String type) {
-			this.type = type;
+			this.type = type == null ? "" : type;
 		}
 
 		/**
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
index 9f7a3bbc6..2ba146dd5 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluator.java
@@ -1142,7 +1142,7 @@ public class RangerDefaultPolicyEvaluator extends RangerAbstractPolicyEvaluator
 
 		if(policyItem != null && CollectionUtils.isNotEmpty(policyItem.getAccesses())) {
 			for(RangerPolicyItemAccess itemAccess : policyItem.getAccesses()) {
-				if(StringUtils.equalsIgnoreCase(itemAccess.getType(), accessType)) {
+				if (itemAccess != null && StringUtils.equalsIgnoreCase(itemAccess.getType(), accessType)) {
 					ret = itemAccess;
 
 					break;