https://issues.apache.org/bugzilla/show_bug.cgi?id=44991





--- Comment #1 from Raul Benito <[EMAIL PROTECTED]>  2008-05-18 10:12:45 PST ---
Thanks for the report. I don't found it, but you are right. I forgot to use the
pointer of the old list to make the RCU working.
With this change it should work and shouldn't be more concurrency problems.
This change is already commited to CVS head.

Thanks again

Index: src/org/apache/xml/security/keys/keyresolver/KeyResolver.java
===================================================================
--- src/org/apache/xml/security/keys/keyresolver/KeyResolver.java      
(revision 657575)
+++ src/org/apache/xml/security/keys/keyresolver/KeyResolver.java      
(working copy)
@@ -123,9 +123,11 @@
            Element element, String BaseURI, StorageResolver storage)
               throws KeyResolverException {

-      for (int i = 0; i < KeyResolver._resolverVector.size(); i++) {
+         // use the old vector to not be hit by updates
+         List resolverVector = KeyResolver._resolverVector;
+      for (int i = 0; i < resolverVector.size(); i++) {
                  KeyResolver resolver=
-            (KeyResolver) KeyResolver._resolverVector.get(i);
+            (KeyResolver) resolverVector.get(i);

                  if (resolver==null) {
             Object exArgs[] = {
@@ -165,10 +167,11 @@
    public static final PublicKey getPublicKey(
            Element element, String BaseURI, StorageResolver storage)
               throws KeyResolverException {
-
-      for (int i = 0; i < KeyResolver._resolverVector.size(); i++) {
+         
+         List resolverVector = KeyResolver._resolverVector;
+      for (int i = 0; i < resolverVector.size(); i++) {
                  KeyResolver resolver=
-            (KeyResolver) KeyResolver._resolverVector.get(i);
+            (KeyResolver) resolverVector.get(i);

                  if (resolver==null) {
             Object exArgs[] = {
@@ -186,7 +189,7 @@
          if (cert!=null) {
                 if (i!=0) {
                 //update resolver.                      
-                        List
resolverVector=(List)((ArrayList)_resolverVector).clone();                      
+                       
resolverVector=(List)((ArrayList)_resolverVector).clone();                      
                                 Object ob=resolverVector.remove(i);
                                 resolverVector.add(0,ob);
                                 _resolverVector=resolverVector;


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to