You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by bu...@apache.org on 2008/05/18 19:12:46 UTC

DO NOT REPLY [Bug 44991] Concurrent invocation of KeyInfo. getX509Certificate() occasionally fails

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





--- Comment #1 from Raul Benito <ra...@r-bg.com>  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.