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 d3578739a RANGER-5480: fix unit tests failure with error
ConcurrentModificationException (#837)
d3578739a is described below
commit d3578739acf2fd0f48e26f9d0cb2bd29813b9b74
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Mon Feb 2 21:56:08 2026 -0800
RANGER-5480: fix unit tests failure with error
ConcurrentModificationException (#837)
---
.../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 a7e2de1da..8bd810a15 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
@@ -264,6 +264,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 abstract static 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 efc457eea..8b8f3d2ef 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
@@ -921,7 +921,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) {