From 24ba06881f28598ec66846f9eb49eb43482166f0 Mon Sep 17 00:00:00 2001 From: Nikhil P Bonte Date: Tue, 20 Feb 2024 18:50:25 +0530 Subject: [PATCH] Fix Update Daap policy NPE --- .../store/graph/v2/preprocessor/AuthPolicyPreProcessor.java | 3 +++ .../store/graph/v2/preprocessor/AuthPolicyValidator.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyPreProcessor.java index e2bb512467..d2552cb69e 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyPreProcessor.java @@ -221,6 +221,9 @@ private void processUpdatePolicy(AtlasStruct entity, AtlasVertex vertex) throws //create ES alias parent.addReferredEntity(policy); + + } if (POLICY_CATEGORY_DATAMESH.equals(policyCategory)) { + validator.validate(policy, existingPolicy, null, UPDATE); } else { validator.validate(policy, null, null, UPDATE); } diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyValidator.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyValidator.java index 502279785b..3c5814d0a7 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyValidator.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AuthPolicyValidator.java @@ -294,7 +294,7 @@ public void validate(AtlasEntity policy, AtlasEntity existingPolicy, "Please provide valid value for attribute " + ATTR_POLICY_SUB_CATEGORY + ":"+ DATAMESH_POLICY_VALID_SUB_CATEGORIES); //validate datamesh policy actions - Set validActions = PURPOSE_POLICY_VALID_ACTIONS.get(policySubCategory); + Set validActions = DATAMESH_POLICY_VALID_ACTIONS.get(policySubCategory); List copyOfActions = new ArrayList<>(policyActions); copyOfActions.removeAll(validActions); validateParam (CollectionUtils.isNotEmpty(copyOfActions),