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

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


The following commit(s) were added to refs/heads/ranger-2.8 by this push:
     new 2181c9365 RANGER-5480: fix unit tests failure with error 
ConcurrentModificationException (#837)
2181c9365 is described below

commit 2181c9365867875b7c50cf5d9669679d74c15986
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Mon Feb 2 21:56:08 2026 -0800

    RANGER-5480: fix unit tests failure with error 
ConcurrentModificationException (#837)
    
    (cherry picked from commit d3578739acf2fd0f48e26f9d0cb2bd29813b9b74)
---
 .../org/apache/ranger/plugin/model/RangerBaseModelObject.java     | 4 ++++
 .../main/java/org/apache/ranger/plugin/model/RangerPolicy.java    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerBaseModelObject.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerBaseModelObject.java
index 72757d276..caf32203b 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerBaseModelObject.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/model/RangerBaseModelObject.java
@@ -247,6 +247,10 @@ public static void setNullSafeSupplier(String supplier) {
                }
        }
 
+       public static <T> List<T> copyOrEmpty(List<T> src) {
+               return src == null ? new ArrayList<>() : new ArrayList<>(src);
+       }
+
        public static abstract class NullSafeSupplier {
                public abstract <T> List<T> toList(List<T> coll);
 
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 279ff69b4..17bbd77f5 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
@@ -903,7 +903,13 @@ public RangerPolicyItem() {
                }
 
                public RangerPolicyItem(RangerPolicyItem other) {
-                       this(other.accesses, other.users, other.groups, 
other.roles, other.conditions, other.delegateAdmin);
+                       this.accesses   = copyOrEmpty(other.accesses);
+                       this.users      = copyOrEmpty(other.users);
+                       this.groups     = copyOrEmpty(other.groups);
+                       this.roles      = copyOrEmpty(other.roles);
+                       this.conditions = copyOrEmpty(other.conditions);
+
+                       setDelegateAdmin(other.delegateAdmin);
                }
 
                public RangerPolicyItem(List<RangerPolicyItemAccess> 
accessTypes, List<String> users, List<String> groups, List<String> roles, 
List<RangerPolicyItemCondition> conditions, Boolean delegateAdmin) {

Reply via email to