You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2005/03/23 19:14:55 UTC

cvs commit: xml-security/src/org/apache/xml/security/c14n Canonicalizer.java

raul        2005/03/23 10:14:54

  Modified:    src/org/apache/xml/security/signature XMLSignatureInput.java
               src/org/apache/xml/security/algorithms
                        SignatureAlgorithm.java
               src/org/apache/xml/security/keys/keyresolver
                        KeyResolver.java
               src/org/apache/xml/security/utils/resolver
                        ResourceResolver.java
               src/org/apache/xml/security/transforms Transform.java
               src/org/apache/xml/security/keys/storage
                        StorageResolver.java
               src/org/apache/xml/security/c14n Canonicalizer.java
  Log:
  Changed from Vector<String> to List<Class>, so we don't need to use classForName everytime and used it just the first time.
  
  Revision  Changes    Path
  1.39      +9 -12     xml-security/src/org/apache/xml/security/signature/XMLSignatureInput.java
  
  Index: XMLSignatureInput.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/signature/XMLSignatureInput.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- XMLSignatureInput.java	9 Mar 2005 23:38:36 -0000	1.38
  +++ XMLSignatureInput.java	23 Mar 2005 18:14:54 -0000	1.39
  @@ -31,14 +31,11 @@
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
  -import javax.xml.transform.TransformerException;
   
  -import org.apache.xml.security.Init;
   import org.apache.xml.security.c14n.CanonicalizationException;
   import org.apache.xml.security.c14n.implementations.Canonicalizer20010315OmitComments;
   import org.apache.xml.security.utils.JavaUtils;
   import org.apache.xml.security.utils.XMLUtils;
  -import org.apache.xml.security.utils.CachedXPathAPIHolder;
   import org.w3c.dom.Document;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  @@ -268,16 +265,16 @@
               Document document = db.parse(new ByteArrayInputStream(result));
   
               //XMLUtils.circumventBug2650(document);
  +            
  +				Set set = new HashSet();
  +				XMLUtils.getSet(
  +						document.getDocumentElement().getFirstChild().getFirstChild(),
  +						set,null,true);
  +              // NodeList nodeList = CachedXPathAPIHolder.getCachedXPathAPI().selectNodeList(
  +              //    document,
  +              //    "(//. | //@* | //namespace::*)[not(self::node()=/) and not(self::node=/container)]");
   
  -            try {
  -               NodeList nodeList = CachedXPathAPIHolder.getCachedXPathAPI().selectNodeList(
  -                  document,
  -                  "(//. | //@* | //namespace::*)[not(self::node()=/) and not(self::node=/container)]");
  -
  -               return XMLUtils.convertNodelistToSet(nodeList);
  -            } catch (TransformerException ex2) {
  -               throw new CanonicalizationException("generic.EmptyMessage", ex2);
  -            }
  +               return set;
            }
         }
   
  
  
  
  1.20      +32 -29    xml-security/src/org/apache/xml/security/algorithms/SignatureAlgorithm.java
  
  Index: SignatureAlgorithm.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/algorithms/SignatureAlgorithm.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SignatureAlgorithm.java	25 Sep 2004 19:42:22 -0000	1.19
  +++ SignatureAlgorithm.java	23 Mar 2005 18:14:54 -0000	1.20
  @@ -63,21 +63,15 @@
         super(doc, algorithmURI);
   
         try {
  -         String implementingClass =
  +         Class implementingClass =
               SignatureAlgorithm.getImplementingClass(algorithmURI);
            if (log.isDebugEnabled())
            	log.debug("Create URI \"" + algorithmURI + "\" class \""
                      + implementingClass + "\"");
   
            this._signatureAlgorithm =
  -            (SignatureAlgorithmSpi) Class.forName(implementingClass)
  -               .newInstance();
  -      } catch (ClassNotFoundException ex) {
  -         Object exArgs[] = { algorithmURI, ex.getMessage() };
  -
  -         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  -                                         ex);
  -      } catch (IllegalAccessException ex) {
  +            (SignatureAlgorithmSpi) implementingClass.newInstance();
  +      }  catch (IllegalAccessException ex) {
            Object exArgs[] = { algorithmURI, ex.getMessage() };
   
            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  @@ -129,24 +123,18 @@
         String algorithmURI = this.getURI();
   
         try {
  -         String implementingClass =
  +         Class implementingClass =
               SignatureAlgorithm.getImplementingClass(algorithmURI);
            if (log.isDebugEnabled())
            	log.debug("Create URI \"" + algorithmURI + "\" class \""
                      + implementingClass + "\"");
   
            this._signatureAlgorithm =
  -            (SignatureAlgorithmSpi) Class.forName(implementingClass)
  -               .newInstance();
  +            (SignatureAlgorithmSpi) implementingClass.newInstance();
   
            this._signatureAlgorithm
               .engineGetContextFromElement(this._constructionElement);
  -      } catch (ClassNotFoundException ex) {
  -         Object exArgs[] = { algorithmURI, ex.getMessage() };
  -
  -         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  -                                         ex);
  -      } catch (IllegalAccessException ex) {
  +      }  catch (IllegalAccessException ex) {
            Object exArgs[] = { algorithmURI, ex.getMessage() };
   
            throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  @@ -343,24 +331,39 @@
       * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
       */
      public static void register(String algorithmURI, String implementingClass)
  -           throws AlgorithmAlreadyRegisteredException {
  +           throws AlgorithmAlreadyRegisteredException,XMLSignatureException {
   
         {
            if (log.isDebugEnabled())
            	log.debug("Try to register " + algorithmURI + " " + implementingClass);
   
            // are we already registered?
  -         String registeredClass =
  +         Class registeredClassClass =
               SignatureAlgorithm.getImplementingClass(algorithmURI);
  +		 if (registeredClassClass!=null) {
  +			 String registeredClass = registeredClassClass.getName();
   
  -         if ((registeredClass != null) && (registeredClass.length() != 0)) {
  -            Object exArgs[] = { algorithmURI, registeredClass };
  -
  -            throw new AlgorithmAlreadyRegisteredException(
  -               "algorithm.alreadyRegistered", exArgs);
  -         }
  +			 if ((registeredClass != null) && (registeredClass.length() != 0)) {
  +				 Object exArgs[] = { algorithmURI, registeredClass };
   
  -         SignatureAlgorithm._algorithmHash.put(algorithmURI, implementingClass);
  +				 throw new AlgorithmAlreadyRegisteredException(
  +						 "algorithm.alreadyRegistered", exArgs);
  +			 }
  +		 }
  +		 try {	         	   			 
  +			 SignatureAlgorithm._algorithmHash.put(algorithmURI, Class.forName(implementingClass));
  +	      } catch (ClassNotFoundException ex) {
  +	         Object exArgs[] = { algorithmURI, ex.getMessage() };
  +
  +	         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  +	                                         ex);
  +	      } catch (NullPointerException ex) {
  +	         Object exArgs[] = { algorithmURI, ex.getMessage() };
  +
  +	         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs,
  +	                                         ex);
  +	      }
  +         
         }
      }
   
  @@ -370,13 +373,13 @@
       * @param URI
       * @return
       */
  -   private static String getImplementingClass(String URI) {
  +   private static Class getImplementingClass(String URI) {
   
         if (SignatureAlgorithm._algorithmHash == null) {
            return null;
         }
   
  -      return (String) SignatureAlgorithm._algorithmHash.get(URI);
  +      return (Class) SignatureAlgorithm._algorithmHash.get(URI);
      }
   
      /**
  
  
  
  1.11      +17 -21    xml-security/src/org/apache/xml/security/keys/keyresolver/KeyResolver.java
  
  Index: KeyResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/keys/keyresolver/KeyResolver.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- KeyResolver.java	25 Sep 2004 19:42:22 -0000	1.10
  +++ KeyResolver.java	23 Mar 2005 18:14:54 -0000	1.11
  @@ -21,6 +21,7 @@
   
   import java.security.PublicKey;
   import java.security.cert.X509Certificate;
  +import java.util.List;
   import java.util.Vector;
   
   import javax.crypto.SecretKey;
  @@ -47,7 +48,7 @@
      static boolean _alreadyInitialized = false;
   
      /** Field _resolverVector */
  -   static Vector _resolverVector = null;
  +   static List _resolverVector = null;
   
      /** Field _resolverSpi */
      protected KeyResolverSpi _resolverSpi = null;
  @@ -88,13 +89,9 @@
       */
      public static KeyResolver item(int i) throws KeyResolverException {
   
  -      String currentClass = (String) KeyResolver._resolverVector.elementAt(i);
  -      KeyResolver resolver = null;
  -
  -      try {
  -         resolver = new KeyResolver(currentClass);
  -      } catch (Exception e) {
  -         throw new KeyResolverException("utils.resolver.noClass", e);
  +	   KeyResolver resolver = (KeyResolver) KeyResolver._resolverVector.get(i);
  +      if (resolver==null) {
  +         throw new KeyResolverException("utils.resolver.noClass");
         }
   
         return resolver;
  @@ -115,26 +112,22 @@
                 throws KeyResolverException {
   
         for (int i = 0; i < KeyResolver._resolverVector.size(); i++) {
  -         String currentClass =
  -            (String) KeyResolver._resolverVector.elementAt(i);
  -         KeyResolver resolver = null;
  -
  -         try {
  -            resolver = new KeyResolver(currentClass);
  -         } catch (Exception e) {
  +		  KeyResolver resolver=
  +            (KeyResolver) KeyResolver._resolverVector.get(i);
  +
  +		  if (resolver==null) {
               Object exArgs[] = {
                  (((element != null)
                    && (element.getNodeType() == Node.ELEMENT_NODE))
                   ? element.getTagName()
                   : "null") };
   
  -            throw new KeyResolverException("utils.resolver.noClass", exArgs, e);
  +            throw new KeyResolverException("utils.resolver.noClass", exArgs);
            }
            if (log.isDebugEnabled())
  -         	log.debug("check resolvability by class " + currentClass);
  +         	log.debug("check resolvability by class " + resolver.getClass());
   
  -         if ((resolver != null)
  -                 && resolver.canResolve(element, BaseURI, storage)) {
  +         if (resolver.canResolve(element, BaseURI, storage)) {
               return resolver;
            }
         }
  @@ -166,9 +159,12 @@
       * {@link org.apache.xml.security.keys.KeyInfo#registerInternalKeyResolver}.
       *
       * @param className
  + * @throws InstantiationException 
  + * @throws IllegalAccessException 
  + * @throws ClassNotFoundException 
       */
  -   public static void register(String className) {
  -      KeyResolver._resolverVector.add(className);
  +   public static void register(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
  +      KeyResolver._resolverVector.add(new KeyResolver(className));
      }
   
      /**
  
  
  
  1.10      +32 -53    xml-security/src/org/apache/xml/security/utils/resolver/ResourceResolver.java
  
  Index: ResourceResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/utils/resolver/ResourceResolver.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ResourceResolver.java	25 Sep 2004 19:42:22 -0000	1.9
  +++ ResourceResolver.java	23 Mar 2005 18:14:54 -0000	1.10
  @@ -19,6 +19,8 @@
   
   
   
  +import java.util.ArrayList;
  +import java.util.List;
   import java.util.Map;
   import java.util.Vector;
   
  @@ -56,10 +58,10 @@
      static boolean _alreadyInitialized = false;
   
      /** these are the system-wide resolvers */
  -   static Vector _resolverVector = null;
  +   static List _resolverVector = null;
   
      /** Field _individualResolverVector */
  -   Vector _individualResolverVector = null;
  +   List _individualResolverVector = null;
   
      /** Field transformSpi */
      protected ResourceResolverSpi _resolverSpi = null;
  @@ -99,25 +101,14 @@
       */
      public static final ResourceResolver getInstance(Attr uri, String BaseURI)
              throws ResourceResolverException {
  -
  -      for (int i = 0; i < ResourceResolver._resolverVector.size(); i++) {
  -         String currentClass =
  -            (String) ResourceResolver._resolverVector.elementAt(i);
  -         ResourceResolver resolver = null;
  -
  -         try {
  -            resolver = new ResourceResolver(currentClass);
  -         } catch (Exception e) {
  -            Object exArgs[] = { ((uri != null)
  -                                 ? uri.getNodeValue()
  -                                 : "null"), BaseURI };
  -
  -            throw new ResourceResolverException("utils.resolver.noClass",
  -                                                exArgs, e, uri, BaseURI);
  -         }
  +      int length=ResourceResolver._resolverVector.size();
  +      for (int i = 0; i < length; i++) {
  +		  ResourceResolver resolver =
  +            (ResourceResolver) ResourceResolver._resolverVector.get(i);
  +         
   
            if (log.isDebugEnabled())
  -         	log.debug("check resolvability by class " + currentClass);
  +         	log.debug("check resolvability by class " + resolver.getClass().getName());
   
            if ((resolver != null) && resolver.canResolve(uri, BaseURI)) {
               return resolver;
  @@ -131,7 +122,6 @@
         throw new ResourceResolverException("utils.resolver.noClass", exArgs,
                                             uri, BaseURI);
      }
  -
      /**
       * Method getInstance
       *
  @@ -151,8 +141,9 @@
         }
   
         // first check the individual Resolvers
  -      if ((individualResolvers != null) && (individualResolvers.size() > 0)) {
  -         for (int i = 0; i < individualResolvers.size(); i++) {
  +	  int size=0;
  +      if ((individualResolvers != null) && ((size=individualResolvers.size()) > 0)) {
  +         for (int i = 0; i < size; i++) {
               ResourceResolver resolver =
                  (ResourceResolver) individualResolvers.elementAt(i);
   
  @@ -168,35 +159,7 @@
            }
         }
   
  -      for (int i = 0; i < ResourceResolver._resolverVector.size(); i++) {
  -         String currentClass =
  -            (String) ResourceResolver._resolverVector.elementAt(i);
  -         ResourceResolver resolver = null;
  -
  -         try {
  -            resolver = new ResourceResolver(currentClass);
  -         } catch (Exception e) {
  -            Object exArgs[] = { ((uri != null)
  -                                 ? uri.getNodeValue()
  -                                 : "null"), BaseURI };
  -
  -            throw new ResourceResolverException("utils.resolver.noClass",
  -                                                exArgs, e, uri, BaseURI);
  -         }
  -         if (log.isDebugEnabled())
  -         	log.debug("check resolvability by class " + currentClass);
  -
  -         if ((resolver != null) && resolver.canResolve(uri, BaseURI)) {
  -            return resolver;
  -         }
  -      }
  -
  -      Object exArgs[] = { ((uri != null)
  -                           ? uri.getNodeValue()
  -                           : "null"), BaseURI };
  -
  -      throw new ResourceResolverException("utils.resolver.noClass", exArgs,
  -                                          uri, BaseURI);
  +	  return getInstance(uri,BaseURI);
      }
   
      /**
  @@ -205,7 +168,7 @@
      public static void init() {
   
         if (!ResourceResolver._alreadyInitialized) {
  -         ResourceResolver._resolverVector = new Vector(10);
  +         ResourceResolver._resolverVector = new ArrayList(10);
            _alreadyInitialized = true;
         }
      }
  @@ -216,7 +179,23 @@
       * @param className
       */
      public static void register(String className) {
  -      ResourceResolver._resolverVector.add(className);
  +	    ResourceResolver resolver = null;
  +
  +        try {
  +           resolver = new ResourceResolver(className);
  +		   ResourceResolver._resolverVector.add(resolver);
  +        } catch (Exception e) {
  +//			Object exArgs[] = { ((uri != null)
  +//                    ? uri.getNodeValue()
  +//                    : "null"), BaseURI };
  +//
  +//			throw new ResourceResolverException("utils.resolver.noClass",
  +//                                   exArgs, e, uri, BaseURI);
  +			log.warn("Error loading resolver " + className +" disabling it");
  +        } catch (NoClassDefFoundError e) {
  +			log.warn("Error loading resolver " + className +" disabling it");
  +        }
  +      
      }
   
      /**
  
  
  
  1.17      +14 -33    xml-security/src/org/apache/xml/security/transforms/Transform.java
  
  Index: Transform.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/transforms/Transform.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Transform.java	25 Sep 2004 19:42:22 -0000	1.16
  +++ Transform.java	23 Mar 2005 18:14:54 -0000	1.17
  @@ -21,7 +21,6 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.util.HashMap;
  -import java.util.Iterator;
   
   import javax.xml.parsers.ParserConfigurationException;
   
  @@ -87,7 +86,7 @@
            this._constructionElement.setAttributeNS(null, Constants._ATT_ALGORITHM,
                                                   algorithmURI);
   
  -         String implementingClass =
  +         Class implementingClass =
               Transform.getImplementingClass(algorithmURI);
            if (log.isDebugEnabled()) {
            	log.debug("Create URI \"" + algorithmURI + "\" class \""
  @@ -97,7 +96,7 @@
   
            // create the custom Transform object
            this.transformSpi =
  -            (TransformSpi) Class.forName(implementingClass).newInstance();
  +            (TransformSpi) implementingClass.newInstance();
   
            this.transformSpi.setTransform(this);
   
  @@ -114,11 +113,6 @@
               }
   
            }
  -      } catch (ClassNotFoundException ex) {
  -         Object exArgs[] = { algorithmURI };
  -
  -         throw new InvalidTransformException(
  -            "signature.Transform.UnknownTransform", exArgs, ex);
         } catch (IllegalAccessException ex) {
            Object exArgs[] = { algorithmURI };
   
  @@ -159,17 +153,12 @@
         }
   
         try {
  -         String implementingClass = (String) _transformHash.get(AlgorithmURI);
  +         Class implementingClass = (Class) _transformHash.get(AlgorithmURI);
   
            this.transformSpi =
  -            (TransformSpi) Class.forName(implementingClass).newInstance();
  +            (TransformSpi) implementingClass.newInstance();
   
            this.transformSpi.setTransform(this);
  -      } catch (ClassNotFoundException e) {
  -         Object exArgs[] = { AlgorithmURI };
  -
  -         throw new InvalidTransformException(
  -            "signature.Transform.UnknownTransform", exArgs);
         } catch (IllegalAccessException e) {
            Object exArgs[] = { AlgorithmURI };
   
  @@ -259,16 +248,21 @@
         {
   
            // are we already registered?
  -         String registeredClass = Transform.getImplementingClass(algorithmURI);
  +         Class registeredClass = Transform.getImplementingClass(algorithmURI);
   
  -         if ((registeredClass != null) && (registeredClass.length() != 0)) {
  +         if ((registeredClass != null) ) {
               Object exArgs[] = { algorithmURI, registeredClass };
   
               throw new AlgorithmAlreadyRegisteredException(
                  "algorithm.alreadyRegistered", exArgs);
            }
   
  -         Transform._transformHash.put(algorithmURI, implementingClass);
  +         try {
  +			Transform._transformHash.put(algorithmURI, Class.forName(implementingClass));
  +		} catch (ClassNotFoundException e) {
  +			// TODO Auto-generated catch block
  +			e.printStackTrace();
  +		}
         }
      }
   
  @@ -354,21 +348,8 @@
       * @param URI
       * @return The name of the class implementing the URI.
       */
  -   private static String getImplementingClass(String URI) {
  -
  -      try {
  -         Iterator i = Transform._transformHash.keySet().iterator();
  -
  -         while (i.hasNext()) {
  -            String key = (String) i.next();
  -
  -            if (key.equals(URI)) {
  -               return (String) Transform._transformHash.get(key);
  -            }
  -         }
  -      } catch (NullPointerException ex) {}
  -
  -      return null;
  +   private static Class getImplementingClass(String URI) {
  +       return (Class)Transform._transformHash.get(URI);
      }
   
      
  
  
  
  1.9       +12 -52    xml-security/src/org/apache/xml/security/keys/storage/StorageResolver.java
  
  Index: StorageResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/keys/storage/StorageResolver.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StorageResolver.java	24 Sep 2004 20:54:28 -0000	1.8
  +++ StorageResolver.java	23 Mar 2005 18:14:54 -0000	1.9
  @@ -21,8 +21,9 @@
   
   import java.security.KeyStore;
   import java.security.cert.X509Certificate;
  +import java.util.ArrayList;
   import java.util.Iterator;
  -import java.util.Vector;
  +import java.util.List;
   
   import org.apache.xml.security.keys.storage.implementations.KeyStoreResolver;
   import org.apache.xml.security.keys.storage.implementations.SingleCertificateResolver;
  @@ -40,7 +41,7 @@
           org.apache.commons.logging.LogFactory.getLog(StorageResolver.class.getName());
   
      /** Field _storageResolvers */
  -   Vector _storageResolvers = new Vector();
  +   List _storageResolvers = new ArrayList();
   
      /** Field _iterator */
      Iterator _iterator = null;
  @@ -121,7 +122,7 @@
      public Iterator getIterator() {
   
         if (this._iterator == null) {
  -         this._iterator = new StorageResolverIterator(this._storageResolvers);
  +         this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
         }
   
         return this._iterator;
  @@ -135,7 +136,7 @@
      public boolean hasNext() {
   
         if (this._iterator == null) {
  -         this._iterator = new StorageResolverIterator(this._storageResolvers);
  +         this._iterator = new StorageResolverIterator(this._storageResolvers.iterator());
         }
   
         return this._iterator.hasNext();
  @@ -159,7 +160,7 @@
      class StorageResolverIterator implements Iterator {
   
         /** Field _resolvers */
  -      Vector _resolvers = null;
  +	   Iterator _resolvers = null;
   
         /** Field _currentResolver */
         int _currentResolver = 0;
  @@ -169,59 +170,18 @@
          *
          * @param resolvers
          */
  -      public StorageResolverIterator(Vector resolvers) {
  +      public StorageResolverIterator(Iterator resolvers) {
            this._resolvers = resolvers;
  -         this._currentResolver = 0;
         }
   
         /** @inheritDoc */
         public boolean hasNext() {
  -
  -         if (this._resolvers == null) {
  -            return false;
  -         }
  -
  -         while (this._currentResolver < this._resolvers.size()) {
  -            StorageResolverSpi current =
  -               (StorageResolverSpi) this._resolvers
  -                  .elementAt(this._currentResolver);
  -
  -            if (current == null) {
  -               continue;
  -            }
  -
  -            if (current.getIterator().hasNext()) {
  -               return true;
  -            } 
  -            this._currentResolver++;            
  -         }
  -
  -         return false;
  +		  return _resolvers.hasNext();
         }
   
         /** @inheritDoc */
         public Object next() {
  -
  -         if (this._resolvers == null) {
  -            return null;
  -         }
  -
  -         while (this._currentResolver < this._resolvers.size()) {
  -            StorageResolverSpi current =
  -               (StorageResolverSpi) this._resolvers
  -                  .elementAt(this._currentResolver);
  -
  -            if (current == null) {
  -               continue;
  -            }
  -
  -            if (current.getIterator().hasNext()) {
  -               return current.getIterator().next();
  -            }
  -            this._currentResolver++;           
  -         }
  -
  -         return null;
  +		  return _resolvers.next();
         }
   
         /**
  
  
  
  1.11      +11 -19    xml-security/src/org/apache/xml/security/c14n/Canonicalizer.java
  
  Index: Canonicalizer.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/c14n/Canonicalizer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Canonicalizer.java	19 Jan 2005 19:28:06 -0000	1.10
  +++ Canonicalizer.java	23 Mar 2005 18:14:54 -0000	1.11
  @@ -21,7 +21,6 @@
   import java.io.ByteArrayInputStream;
   import java.io.OutputStream;
   import java.util.HashMap;
  -import java.util.Iterator;
   import java.util.Map;
   import java.util.Set;
   
  @@ -98,10 +97,10 @@
              throws InvalidCanonicalizerException {
   
         try {
  -         String implementingClass = getImplementingClass(algorithmURI);
  +         Class implementingClass = getImplementingClass(algorithmURI);
   
            this.canonicalizerSpi =
  -            (CanonicalizerSpi) Class.forName(implementingClass).newInstance();
  +            (CanonicalizerSpi) implementingClass.newInstance();
            this.canonicalizerSpi.reset=true;
         } catch (Exception e) {
            Object exArgs[] = { algorithmURI };
  @@ -137,16 +136,20 @@
              throws AlgorithmAlreadyRegisteredException {
   
         // check whether URI is already registered
  -      String registeredClass = getImplementingClass(algorithmURI);
  +      Class registeredClass = getImplementingClass(algorithmURI);
   
  -      if ((registeredClass != null) && (registeredClass.length() != 0)) {
  +      if (registeredClass != null)  {
            Object exArgs[] = { algorithmURI, registeredClass };
   
            throw new AlgorithmAlreadyRegisteredException(
               "algorithm.alreadyRegistered", exArgs);
         }
   
  -      _canonicalizerHash.put(algorithmURI, implementingClass);
  +      try {
  +		_canonicalizerHash.put(algorithmURI, Class.forName(implementingClass));
  +	} catch (ClassNotFoundException e) {
  +		throw new RuntimeException("c14n class not found");
  +	}
      }
   
      /**
  @@ -333,19 +336,8 @@
       * @param URI
       * @return the name of the class that implements the give URI
       */
  -   private static String getImplementingClass(String URI) {
  -
  -      Iterator i = _canonicalizerHash.keySet().iterator();
  -
  -      while (i.hasNext()) {
  -         String key = (String) i.next();
  -
  -         if (key.equals(URI)) {
  -            return (String) _canonicalizerHash.get(key);
  -         }
  -      }
  -
  -      return null;
  +   private static Class getImplementingClass(String URI) {
  +      return (Class) _canonicalizerHash.get(URI);         
      }
      
      public void notReset() {