This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new 1b142ac1d RANGER-4247: initialize RangerPolicyRepository members
before logging (#258)
1b142ac1d is described below
commit 1b142ac1d9cdf79d51c41a4eab06f7b530f80430
Author: Yubi Lee <[email protected]>
AuthorDate: Fri Jan 2 23:13:51 2026 -0800
RANGER-4247: initialize RangerPolicyRepository members before logging (#258)
Signed-off-by: Madhan Neethiraj <[email protected]>
---
.../plugin/policyengine/RangerPolicyRepository.java | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
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 1c1a0efd0..6eee0143c 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
@@ -193,7 +193,7 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
this.componentServiceDef = this.serviceDef;
this.zoneName = zoneName;
this.appId = pluginContext.getConfig().getAppId();
- this.options = new
RangerPolicyEngineOptions(pluginContext.getConfig().getPolicyEngineOptions());
+ this.options = new
RangerPolicyEngineOptions(pluginContext.getConfig().getPolicyEngineOptions(),
new RangerServiceDefHelper(serviceDef, false));
this.pluginContext = pluginContext;
if (StringUtils.isEmpty(zoneName)) {
@@ -230,8 +230,6 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
LOG.debug("RangerPolicyRepository : building policy-repository for
service[{}], and zone:[{}] with auditMode[{}]", serviceName, zoneName,
auditModeEnum);
- init(options);
-
if (StringUtils.isEmpty(zoneName)) {
this.contextEnrichers = buildContextEnrichers(options);
this.auditPolicyEvaluators =
buildAuditPolicyEvaluators(servicePolicies.getServiceConfig());
@@ -240,6 +238,8 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
this.auditPolicyEvaluators = Collections.emptyList();
}
+ init(options);
+
if (options.disableTrieLookupPrefilter) {
policyResourceTrie = null;
dataMaskResourceTrie = null;
@@ -262,7 +262,7 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
this.serviceDef =
ServiceDefUtil.normalizeAccessTypeDefs(ServiceDefUtil.normalize(tagPolicies.getServiceDef()),
componentServiceDef.getName());
this.componentServiceDef = componentServiceDef;
this.appId = pluginContext.getConfig().getAppId();
- this.options = new
RangerPolicyEngineOptions(pluginContext.getConfig().getPolicyEngineOptions());
+ this.options = new
RangerPolicyEngineOptions(pluginContext.getConfig().getPolicyEngineOptions(),
new RangerServiceDefHelper(serviceDef, false));
this.pluginContext = pluginContext;
this.policies =
normalizeAndPrunePolicies(tagPolicies.getPolicies(),
componentServiceDef.getName());
this.policyVersion = tagPolicies.getPolicyVersion() != null ?
tagPolicies.getPolicyVersion() : -1;
@@ -281,8 +281,6 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
LOG.debug("RangerPolicyRepository : building tag-policy-repository for
tag service:[{}], with auditMode[{}]", serviceName, auditModeEnum);
- init(options);
-
if (StringUtils.isEmpty(zoneName)) {
this.contextEnrichers = buildContextEnrichers(options);
this.auditPolicyEvaluators =
buildAuditPolicyEvaluators(tagPolicies.getServiceConfig());
@@ -291,6 +289,8 @@ public RangerPolicyRepository(ServicePolicies
servicePolicies, RangerPluginConte
this.auditPolicyEvaluators = Collections.emptyList();
}
+ init(options);
+
if (options.disableTrieLookupPrefilter) {
policyResourceTrie = null;
dataMaskResourceTrie = null;
@@ -920,10 +920,6 @@ private static boolean
skipBuildingPolicyEvaluator(RangerPolicy policy, RangerPo
}
private void init(RangerPolicyEngineOptions options) {
- RangerServiceDefHelper serviceDefHelper = new
RangerServiceDefHelper(serviceDef, false);
-
- options.setServiceDefHelper(serviceDefHelper);
-
List<RangerPolicyEvaluator> policyEvaluators = new
ArrayList<>();
List<RangerPolicyEvaluator> dataMaskPolicyEvaluators = new
ArrayList<>();
List<RangerPolicyEvaluator> rowFilterPolicyEvaluators = new
ArrayList<>();