You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ge...@apache.org on 2002/09/28 11:19:37 UTC
cvs commit: xml-security/src/org/apache/xml/security/transforms/implementations TransformBase64Decode.java TransformXPathFilterCHGP.java
geuerp 2002/09/28 02:19:37
Modified: src/org/apache/xml/security/transforms/implementations
TransformBase64Decode.java
TransformXPathFilterCHGP.java
Removed: src/org/apache/xml/security/c14n/helper
AlwaysAcceptNodeFilter.java
Log:
Moved AlwaysAcceptNodeFilter into TransformBase64Decode which uses it exclusively
Revision Changes Path
1.11 +30 -20 xml-security/src/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java
Index: TransformBase64Decode.java
===================================================================
RCS file: /home/cvs/xml-security/src/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TransformBase64Decode.java 28 Aug 2002 12:08:28 -0000 1.10
+++ TransformBase64Decode.java 28 Sep 2002 09:19:37 -0000 1.11
@@ -1,3 +1,4 @@
+
/*
* The Apache Software License, Version 1.1
*
@@ -60,28 +61,20 @@
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import org.w3c.dom.*;
-import org.w3c.dom.traversal.*;
-import org.apache.xpath.XPathAPI;
-import org.apache.xpath.objects.XObject;
+import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.TransformerException;
-import org.xml.sax.SAXException;
+import org.apache.xml.dtm.DTMManager;
+import org.apache.xml.security.c14n.*;
import org.apache.xml.security.exceptions.Base64DecodingException;
import org.apache.xml.security.signature.XMLSignatureInput;
-import org.apache.xml.security.c14n.Canonicalizer;
-import org.apache.xml.security.c14n.CanonicalizationException;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
-import org.apache.xml.security.utils.Base64;
-import org.apache.xml.security.utils.Constants;
-import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.transforms.*;
-import org.apache.xml.dtm.DTMManager;
+import org.apache.xml.security.utils.*;
import org.apache.xpath.CachedXPathAPI;
+import org.apache.xpath.objects.XObject;
+import org.w3c.dom.*;
+import org.w3c.dom.traversal.*;
+import org.xml.sax.SAXException;
/**
@@ -159,14 +152,13 @@
} else {
try {
Document doc =
- DocumentBuilderFactory.newInstance().newDocumentBuilder()
- .parse(input.getOctetStream());
+ DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
+ input.getOctetStream());
DocumentTraversal dt = ((DocumentTraversal) doc);
Node rootNode = (Node) doc;
// we accept all nodes
- NodeFilter nodefilter =
- new org.apache.xml.security.c14n.helper.AlwaysAcceptNodeFilter();
+ NodeFilter nodefilter = new AlwaysAcceptNodeFilter();
TreeWalker treewalker = dt.createTreeWalker(rootNode,
NodeFilter.SHOW_ALL,
nodefilter, true);
@@ -210,5 +202,23 @@
}
treewalker.setCurrentNode(currentNode);
+ }
+
+ /**
+ * This {@link NodeFilter} always returns <code>true</code>
+ *
+ * @author Christian Geuer-Pollmann
+ */
+ public class AlwaysAcceptNodeFilter implements NodeFilter {
+
+ /**
+ * Method acceptNode
+ *
+ * @param n
+ *
+ */
+ public short acceptNode(Node n) {
+ return NodeFilter.FILTER_ACCEPT;
+ }
}
}
1.6 +20 -3 xml-security/src/org/apache/xml/security/transforms/implementations/TransformXPathFilterCHGP.java
Index: TransformXPathFilterCHGP.java
===================================================================
RCS file: /home/cvs/xml-security/src/org/apache/xml/security/transforms/implementations/TransformXPathFilterCHGP.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TransformXPathFilterCHGP.java 28 Aug 2002 12:08:28 -0000 1.5
+++ TransformXPathFilterCHGP.java 28 Sep 2002 09:19:37 -0000 1.6
@@ -251,8 +251,7 @@
Node rootNode = (Node) inputDoc;
// we accept all nodes
- NodeFilter nodefilter =
- new org.apache.xml.security.c14n.helper.AlwaysAcceptNodeFilter();
+ NodeFilter nodefilter = new AlwaysAcceptNodeFilter();
TreeWalker treewalker = dt.createTreeWalker(rootNode,
NodeFilter.SHOW_ALL,
nodefilter, true);
@@ -377,5 +376,23 @@
}
return set;
+ }
+
+ /**
+ * This {@link NodeFilter} always returns <code>true</code>
+ *
+ * @author Christian Geuer-Pollmann
+ */
+ public class AlwaysAcceptNodeFilter implements NodeFilter {
+
+ /**
+ * Method acceptNode
+ *
+ * @param n
+ *
+ */
+ public short acceptNode(Node n) {
+ return NodeFilter.FILTER_ACCEPT;
+ }
}
}