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/02/13 13:07:42 UTC

cvs commit: xml-security/src/org/apache/xml/security/utils/resolver/implementations ResolverFragment.java

raul        2005/02/13 04:07:42

  Modified:    src/org/apache/xml/security/utils/resolver/implementations
                        ResolverFragment.java
  Log:
  Throw an exception when the Id cannot not found.
  
  Revision  Changes    Path
  1.23      +10 -2     xml-security/src/org/apache/xml/security/utils/resolver/implementations/ResolverFragment.java
  
  Index: ResolverFragment.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/utils/resolver/implementations/ResolverFragment.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ResolverFragment.java	24 Dec 2004 12:26:17 -0000	1.22
  +++ ResolverFragment.java	13 Feb 2005 12:07:42 -0000	1.23
  @@ -21,6 +21,7 @@
   import org.apache.xml.security.signature.XMLSignatureInput;
   import org.apache.xml.security.utils.CachedXPathAPIHolder;
   import org.apache.xml.security.utils.IdResolver;
  +import org.apache.xml.security.utils.resolver.ResourceResolverException;
   import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
   import org.apache.xml.utils.URI;
   import org.w3c.dom.Attr;
  @@ -53,7 +54,8 @@
       * @param BaseURI
       *
       */
  -   public XMLSignatureInput engineResolve(Attr uri, String BaseURI)
  +   public XMLSignatureInput engineResolve(Attr uri, String BaseURI) 
  +       throws ResourceResolverException
      {
   
         String uriNodeValue = uri.getNodeValue();
  @@ -84,12 +86,18 @@
   
            // Element selectedElem = doc.getElementById(id);
            selectedElem = IdResolver.getElementById(doc, id);
  +         if (selectedElem==null) {
  +         	Object exArgs[] = { id };
  +            throw new ResourceResolverException(
  +               "signature.Verification.MissingID", exArgs, uri, BaseURI);
  +         }
            if (log.isDebugEnabled())
            	log.debug("Try to catch an Element with ID " + id + " and Element was " + selectedElem);
         }
   
         //Set resultSet = dereferenceSameDocumentURI(selectedElem);
  -      XMLSignatureInput result = new XMLSignatureInput(selectedElem,new CachedXPathAPIHolder(doc));
  +      CachedXPathAPIHolder.setDoc(doc);
  +      XMLSignatureInput result = new XMLSignatureInput(selectedElem);
         result.setExcludeComments(true);
   
         //log.debug("We return a nodeset with " + resultSet.size() + " nodes");