prevent possible ConcurrentModificationException

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1443251 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-06 22:40:31 +00:00
parent 8cdee9cde3
commit 473f6723be
1 changed files with 7 additions and 2 deletions

View File

@ -706,6 +706,9 @@ public abstract class AbstractRBACManager
boolean childRoleNamesUpdated = false;
Iterator<String> it = role.getChildRoleNames().listIterator();
List<String> updatedChildRoleList = new ArrayList<String>( 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 );
}