From 473f6723befb5058476d549e5b5a7d70a77ac4db Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 6 Feb 2013 22:40:31 +0000 Subject: [PATCH] prevent possible ConcurrentModificationException git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1443251 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/redback/rbac/AbstractRBACManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java b/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java index 4acb7c05..b68bc9c3 100644 --- a/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java +++ b/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java @@ -706,6 +706,9 @@ public abstract class AbstractRBACManager boolean childRoleNamesUpdated = false; Iterator it = role.getChildRoleNames().listIterator(); + + List updatedChildRoleList = new ArrayList( role.getChildRoleNames().size() ); + while ( it.hasNext() ) { String roleName = it.next(); @@ -713,17 +716,19 @@ public abstract class AbstractRBACManager { Role child = getRole( roleName ); childRoles.put( child.getName(), child ); + updatedChildRoleList.add( roleName ); } catch ( RbacObjectNotFoundException e ) { - // Found a bad roleName! - remove it. - it.remove(); + // Found a bad roleName! - trigger new List save + //it.remove(); childRoleNamesUpdated = true; } } if ( childRoleNamesUpdated ) { + role.setChildRoleNames( updatedChildRoleList ); saveRole( role ); }