You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2020/01/17 12:45:20 UTC
svn commit: r1872917 -
/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java
Author: coheigea
Date: Fri Jan 17 12:45:20 2020
New Revision: 1872917
URL: http://svn.apache.org/viewvc?rev=1872917&view=rev
Log:
Removing untested code from TransformBase64Decode
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java?rev=1872917&r1=1872916&r2=1872917&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java Fri Jan 17 12:45:20 2020
@@ -21,19 +21,15 @@ package org.apache.xml.security.transfor
import java.io.IOException;
import java.io.OutputStream;
-import javax.xml.parsers.ParserConfigurationException;
-
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.transforms.TransformSpi;
import org.apache.xml.security.transforms.TransformationException;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.XMLUtils;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
-import org.xml.sax.SAXException;
import org.apache.xml.security.utils.JavaUtils;
@@ -98,9 +94,7 @@ public class TransformBase64Decode exten
output.setSecureValidation(secureValidation);
output.setOutputStream(os);
return output;
- }
-
- if (input.isOctetStream() || input.isNodeSet()) {
+ } else if (input.isOctetStream() || input.isNodeSet()) {
if (os == null) {
byte[] base64Bytes = input.getBytes();
byte[] decodedBytes = XMLUtils.decode(base64Bytes);
@@ -122,27 +116,10 @@ public class TransformBase64Decode exten
return output;
}
- try {
- //Exceptional case there is current not text case testing this(Before it was a
- //a common case).
- Document doc =
- XMLUtils.read(input.getOctetStream(), secureValidation);
-
- Element rootNode = doc.getDocumentElement();
- StringBuilder sb = new StringBuilder();
- traverseElement(rootNode, sb);
- byte[] decodedBytes = XMLUtils.decode(sb.toString());
- XMLSignatureInput output = new XMLSignatureInput(decodedBytes);
- output.setSecureValidation(secureValidation);
- return output;
- } catch (ParserConfigurationException e) {
- throw new TransformationException(e, "c14n.Canonicalizer.Exception");
- } catch (SAXException e) {
- throw new TransformationException(e, "SAX exception");
- }
+ throw new TransformationException("empty", new Object[] {"Unrecognized XMLSignatureInput state"});
}
- void traverseElement(Element node, StringBuilder sb) {
+ private void traverseElement(Element node, StringBuilder sb) {
Node sibling = node.getFirstChild();
while (sibling != null) {
if (Node.ELEMENT_NODE == sibling.getNodeType()) {