You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2004/03/06 12:39:50 UTC

cvs commit: xml-security/src/org/apache/xml/security/algorithms JCEMapper.java

blautenb    2004/03/06 03:39:50

  Modified:    src/org/apache/xml/security/algorithms JCEMapper.java
  Log:
  Support multiple descriptors for a single provider
  
  Revision  Changes    Path
  1.19      +27 -20    xml-security/src/org/apache/xml/security/algorithms/JCEMapper.java
  
  Index: JCEMapper.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/algorithms/JCEMapper.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- JCEMapper.java	8 Feb 2004 06:09:55 -0000	1.18
  +++ JCEMapper.java	6 Mar 2004 11:39:49 -0000	1.19
  @@ -117,25 +117,32 @@
         boolean available = false;
   
         try {
  -         Element pro =
  -            (Element) XPathAPI.selectSingleNode(JCEMapper._providerList,
  -                                                "./x:Providers/x:Provider[@Id='"
  -                                                + providerId + "']",
  -                                                JCEMapper._nscontext);
  -         String providerClass = pro.getAttributeNS(null, "Class");
  -         java.security.Provider prov =
  -            (java.security.Provider) Class.forName(providerClass).newInstance();
  +		  /* Allow for mulitple provider entries with same Id */
  +		  NodeList providers = XPathAPI.selectNodeList(JCEMapper._providerList,
  +													   "./x:Providers/x:Provider[@Id='"
  +													   + providerId + "']",
  +													   JCEMapper._nscontext);
   
  -         if (prov != null) {
  -            available = true;
  -         }
  +         for (int i = 0; available == false && i < providers.getLength(); i++) {
  +            Element pro = (Element) providers.item(i);
  +
  +			String providerClass = pro.getAttributeNS(null, "Class");
  +			try {
  +				java.security.Provider prov =
  +					(java.security.Provider) Class.forName(providerClass).newInstance();
  +
  +				if (prov != null) {
  +					available = true;
  +				}
  +			} catch (ClassNotFoundException ex) {
  +				//do nothing
  +			} catch (IllegalAccessException ex) {
  +				//do nothing
  +			} catch (InstantiationException ex) {
  +				//do nothing
  +			}
  +		 }
         } catch (TransformerException ex) {
  -		//do nothing
  -      } catch (ClassNotFoundException ex) {
  -		//do nothing
  -      } catch (IllegalAccessException ex) {
  -		//do nothing
  -      } catch (InstantiationException ex) {
   		//do nothing
         }