You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2005/08/11 21:36:12 UTC

cvs commit: xml-security/src/org/apache/xml/security/transforms/implementations TransformXPath2Filter.java

mullan      2005/08/11 12:36:12

  Modified:    src/org/apache/xml/security/transforms/implementations
                        TransformXPath2Filter.java
  Log:
  Fix NullPointerException in engineTransform if XMLSignatureInput is a
  node-set (instead of an element subtree).
  
  Revision  Changes    Path
  1.19      +15 -3     xml-security/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java
  
  Index: TransformXPath2Filter.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TransformXPath2Filter.java	22 May 2005 10:35:02 -0000	1.18
  +++ TransformXPath2Filter.java	11 Aug 2005 19:36:12 -0000	1.19
  @@ -18,9 +18,11 @@
   
   
   
  +import java.io.IOException;
   import java.util.ArrayList;
   import java.util.List;
   
  +import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.transform.TransformerException;
   
   import org.apache.xml.security.c14n.CanonicalizationException;
  @@ -40,7 +42,7 @@
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  -
  +import org.xml.sax.SAXException;
   
   /**
    * Implements the <I>XML Signature XPath Filter v2.0</I>
  @@ -107,8 +109,12 @@
               throw new TransformationException("xml.WrongContent", exArgs);
            }
   
  -            Document inputDoc = XMLUtils.getOwnerDocument(input.getSubNode());
  -
  +         Document inputDoc = null;
  +	 if (input.getSubNode() != null) {   
  +            inputDoc = XMLUtils.getOwnerDocument(input.getSubNode());
  +	 } else {
  +            inputDoc = XMLUtils.getOwnerDocument(input.getNodeSet());
  +	 }
   
            for (int i = 0; i < noOfSteps; i++) {
               Element xpathElement =XMLUtils.selectNode(
  @@ -148,6 +154,12 @@
            throw new TransformationException("empty", ex);
         } catch (XMLSecurityException ex) {
            throw new TransformationException("empty", ex);
  +      } catch (SAXException ex) {
  +         throw new TransformationException("empty", ex);
  +      } catch (IOException ex) {
  +         throw new TransformationException("empty", ex);
  +      } catch (ParserConfigurationException ex) {
  +         throw new TransformationException("empty", ex);
         } 
      }
   }