Skip to content

Commit 65a2541

Browse files
committed
RANGER-5480: fix unit tests failure with error ConcurrentModificationException
1 parent 98af26f commit 65a2541

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,13 @@ public RangerPolicyItem() {
921921
}
922922

923923
public RangerPolicyItem(RangerPolicyItem other) {
924-
this(other.accesses, other.users, other.groups, other.roles, other.conditions, other.delegateAdmin);
924+
this.accesses = other.accesses == null ? new ArrayList<>() : new ArrayList<>(other.accesses);
925+
this.users = other.users == null ? new ArrayList<>() : new ArrayList<>(other.users);
926+
this.groups = other.groups == null ? new ArrayList<>() : new ArrayList<>(other.groups);
927+
this.roles = other.roles == null ? new ArrayList<>() : new ArrayList<>(other.roles);
928+
this.conditions = other.accesses == null ? new ArrayList<>() : new ArrayList<>(other.conditions);
929+
930+
setDelegateAdmin(other.delegateAdmin);
925931
}
926932

927933
public RangerPolicyItem(List<RangerPolicyItemAccess> accessTypes, List<String> users, List<String> groups, List<String> roles, List<RangerPolicyItemCondition> conditions, Boolean delegateAdmin) {

0 commit comments

Comments
 (0)