[jboss-cvs] JBossAS SVN: r111965 - projects/security/security-jboss-sx/branches/Branch_2_0/identity/src/main/java/org/jboss/security/identity/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 9 10:36:02 EDT 2011


Author: dehort
Date: 2011-08-09 10:36:02 -0400 (Tue, 09 Aug 2011)
New Revision: 111965

Modified:
   projects/security/security-jboss-sx/branches/Branch_2_0/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java
Log:
Fix for a ConcurrentModificationException that happens in the SimpleRoleGroup
[SECURITY-592]


Modified: projects/security/security-jboss-sx/branches/Branch_2_0/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2011-08-09 12:47:01 UTC (rev 111964)
+++ projects/security/security-jboss-sx/branches/Branch_2_0/identity/src/main/java/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2011-08-09 14:36:02 UTC (rev 111965)
@@ -25,6 +25,7 @@
 import java.security.acl.Group;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Set;
@@ -173,7 +174,7 @@
       {
          //Dealing with another roleGroup
          RoleGroup anotherRG = (RoleGroup) anotherRole;
-         List<Role> anotherRoles = anotherRG.getRoles();
+         CopyOnWriteArrayList<Role> anotherRoles = new CopyOnWriteArrayList<Role>(anotherRG.getRoles());
          for (Role r : anotherRoles)
          {
             //if any of the roles are not there, no point checking further
@@ -193,7 +194,7 @@
    {
       if (anotherRole == null)
          throw new IllegalArgumentException("anotherRole is null");
-      List<Role> roleList = anotherRole.getRoles();
+      CopyOnWriteArrayList<Role> roleList = new CopyOnWriteArrayList<Role>(anotherRole.getRoles());
       for (Role r : roleList)
       {
          if (this.containsAll(r))
@@ -238,4 +239,4 @@
       builder.append(")");
       return builder.toString();
    }
-}
\ No newline at end of file
+}



More information about the jboss-cvs-commits mailing list