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 2015/12/15 18:13:22 UTC
svn commit: r1720201 [4/24] - in /santuario/xml-security-java/trunk:
samples/javax/xml/crypto/dsig/samples/
samples/org/apache/xml/security/samples/
samples/org/apache/xml/security/samples/algorithms/
samples/org/apache/xml/security/samples/canonicaliz...
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java Tue Dec 15 17:13:17 2015
@@ -48,9 +48,9 @@ import org.xml.sax.SAXException;
* implementation of "Canonical XML". A big "thank you" to Ren?? for this.
* <BR />
* <i>THIS </i> implementation is a complete rewrite of the algorithm.
- *
+ *
* @author Christian Geuer-Pollmann <ge...@apache.org>
- * @version $Revision$
+ * @version $Revision$
* @see <a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/ Exclusive#">
* XML Canonicalization, Version 1.0</a>
*/
@@ -65,12 +65,12 @@ public abstract class Canonicalizer20010
*/
private SortedSet<String> inclusiveNSSet;
private boolean propagateDefaultNamespace = false;
-
+
private final SortedSet<Attr> result = new TreeSet<Attr>(COMPARE);
/**
* Constructor Canonicalizer20010315Excl
- *
+ *
* @param includeComments
*/
public Canonicalizer20010315Excl(boolean includeComments) {
@@ -81,7 +81,7 @@ public abstract class Canonicalizer20010
* Method engineCanonicalizeSubTree
* @inheritDoc
* @param rootNode
- *
+ *
* @throws CanonicalizationException
*/
public byte[] engineCanonicalizeSubTree(Node rootNode)
@@ -94,7 +94,7 @@ public abstract class Canonicalizer20010
* @inheritDoc
* @param rootNode
* @param inclusiveNamespaces
- *
+ *
* @throws CanonicalizationException
*/
public byte[] engineCanonicalizeSubTree(
@@ -120,10 +120,10 @@ public abstract class Canonicalizer20010
}
/**
- * Method engineCanonicalizeSubTree
+ * Method engineCanonicalizeSubTree
* @param rootNode
- * @param inclusiveNamespaces
- * @param excl A element to exclude from the c14n process.
+ * @param inclusiveNamespaces
+ * @param excl A element to exclude from the c14n process.
* @return the rootNode c14n.
* @throws CanonicalizationException
*/
@@ -135,7 +135,7 @@ public abstract class Canonicalizer20010
}
/**
- *
+ *
* @param rootNode
* @param inclusiveNamespaces
* @return the rootNode c14n.
@@ -147,7 +147,7 @@ public abstract class Canonicalizer20010
inclusiveNSSet = InclusiveNamespaces.prefixStr2Set(inclusiveNamespaces);
return super.engineCanonicalize(rootNode);
}
-
+
/**
* Method engineCanonicalizeXPathNodeSet
* @inheritDoc
@@ -161,21 +161,21 @@ public abstract class Canonicalizer20010
inclusiveNSSet = InclusiveNamespaces.prefixStr2Set(inclusiveNamespaces);
return super.engineCanonicalizeXPathNodeSet(xpathNodeSet);
}
-
+
@Override
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException {
// result will contain the attrs which have to be output
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
-
- // The prefix visibly utilized (in the attribute or in the name) in
+
+ // The prefix visibly utilized (in the attribute or in the name) in
// the element
SortedSet<String> visiblyUtilized = new TreeSet<String>();
if (inclusiveNSSet != null && !inclusiveNSSet.isEmpty()) {
visiblyUtilized.addAll(inclusiveNSSet);
}
-
+
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
int attrsLength = attrs.getLength();
@@ -183,19 +183,19 @@ public abstract class Canonicalizer20010
Attr attribute = (Attr) attrs.item(i);
String NName = attribute.getLocalName();
String NNodeValue = attribute.getNodeValue();
-
+
if (!XMLNS_URI.equals(attribute.getNamespaceURI())) {
// Not a namespace definition.
- // The Element is output element, add the prefix (if used) to
+ // The Element is output element, add the prefix (if used) to
// visiblyUtilized
String prefix = attribute.getPrefix();
if (prefix != null && !(prefix.equals(XML) || prefix.equals(XMLNS))) {
visiblyUtilized.add(prefix);
- }
+ }
// Add to the result.
result.add(attribute);
} else if (!(XML.equals(NName) && XML_LANG_URI.equals(NNodeValue))
- && ns.addMapping(NName, NNodeValue, attribute)
+ && ns.addMapping(NName, NNodeValue, attribute)
&& C14nHelper.namespaceIsRelative(NNodeValue)) {
// The default mapping for xml must not be output.
// New definition check if it is relative.
@@ -221,17 +221,17 @@ public abstract class Canonicalizer20010
prefix = XMLNS;
}
visiblyUtilized.add(prefix);
-
+
for (String s : visiblyUtilized) {
Attr key = ns.getMapping(s);
if (key != null) {
result.add(key);
}
}
-
- return result.iterator();
+
+ return result.iterator();
}
-
+
/**
* @inheritDoc
* @param element
@@ -241,10 +241,10 @@ public abstract class Canonicalizer20010
protected final Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException {
// result will contain the attrs which have to be output
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
- // The prefix visibly utilized (in the attribute or in the name) in
+ // The prefix visibly utilized (in the attribute or in the name) in
// the element
Set<String> visiblyUtilized = null;
// It's the output selected.
@@ -257,17 +257,17 @@ public abstract class Canonicalizer20010
}
if (element.hasAttributes()) {
- NamedNodeMap attrs = element.getAttributes();
+ NamedNodeMap attrs = element.getAttributes();
int attrsLength = attrs.getLength();
for (int i = 0; i < attrsLength; i++) {
Attr attribute = (Attr) attrs.item(i);
-
+
String NName = attribute.getLocalName();
String NNodeValue = attribute.getNodeValue();
-
+
if (!XMLNS_URI.equals(attribute.getNamespaceURI())) {
if (isVisible(attribute) && isOutputElement) {
- // The Element is output element, add the prefix (if used)
+ // The Element is output element, add the prefix (if used)
// to visibyUtilized
String prefix = attribute.getPrefix();
if (prefix != null && !(prefix.equals(XML) || prefix.equals(XMLNS))) {
@@ -279,8 +279,8 @@ public abstract class Canonicalizer20010
} else if (isOutputElement && !isVisible(attribute) && !XMLNS.equals(NName)) {
ns.removeMappingIfNotRender(NName);
} else {
- if (!isOutputElement && isVisible(attribute)
- && inclusiveNSSet.contains(NName)
+ if (!isOutputElement && isVisible(attribute)
+ && inclusiveNSSet.contains(NName)
&& !ns.removeMappingIfRender(NName)) {
Node n = ns.addMappingAndRender(NName, NNodeValue, attribute);
if (n != null) {
@@ -306,11 +306,11 @@ public abstract class Canonicalizer20010
}
}
- if (isOutputElement) {
- // The element is visible, handle the xmlns definition
+ if (isOutputElement) {
+ // The element is visible, handle the xmlns definition
Attr xmlns = element.getAttributeNodeNS(XMLNS_URI, XMLNS);
if (xmlns != null && !isVisible(xmlns)) {
- // There is a definition but the xmlns is not selected by the
+ // There is a definition but the xmlns is not selected by the
// xpath. then xmlns=""
ns.addMapping(XMLNS, "", getNullNode(xmlns.getOwnerDocument()));
}
@@ -323,20 +323,20 @@ public abstract class Canonicalizer20010
prefix = XMLNS;
}
visiblyUtilized.add(prefix);
-
+
for (String s : visiblyUtilized) {
Attr key = ns.getMapping(s);
if (key != null) {
result.add(key);
}
}
- }
+ }
- return result.iterator();
+ return result.iterator();
}
- protected void circumventBugIfNeeded(XMLSignatureInput input)
- throws CanonicalizationException, ParserConfigurationException,
+ protected void circumventBugIfNeeded(XMLSignatureInput input)
+ throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException {
if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
return;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315ExclOmitComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315ExclOmitComments.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315ExclOmitComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315ExclOmitComments.java Tue Dec 15 17:13:17 2015
@@ -23,7 +23,7 @@ import org.apache.xml.security.c14n.Cano
public class Canonicalizer20010315ExclOmitComments extends Canonicalizer20010315Excl {
/**
- *
+ *
*/
public Canonicalizer20010315ExclOmitComments() {
super(false);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerBase.java Tue Dec 15 17:13:17 2015
@@ -57,9 +57,9 @@ import org.xml.sax.SAXException;
public abstract class CanonicalizerBase extends CanonicalizerSpi {
public static final String XML = "xml";
public static final String XMLNS = "xmlns";
-
+
protected static final AttrCompare COMPARE = new AttrCompare();
-
+
// Make sure you clone the following mutable arrays before passing to
// potentially untrusted objects such as OutputStreams.
private static final byte[] END_PI = {'?','>'};
@@ -75,18 +75,18 @@ public abstract class CanonicalizerBase
private static final byte[] END_TAG = {'<','/'};
private static final byte[] AMP = {'&','a','m','p',';'};
private static final byte[] EQUALS_STR = {'=','\"'};
-
+
protected static final int NODE_BEFORE_DOCUMENT_ELEMENT = -1;
protected static final int NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT = 0;
protected static final int NODE_AFTER_DOCUMENT_ELEMENT = 1;
-
+
private List<NodeFilter> nodeFilter;
- private boolean includeComments;
+ private boolean includeComments;
private Set<Node> xpathNodeSet;
/**
- * The node to be skipped/excluded from the DOM tree
+ * The node to be skipped/excluded from the DOM tree
* in subtree canonicalizations.
*/
private Node excludeNode;
@@ -116,7 +116,7 @@ public abstract class CanonicalizerBase
throws CanonicalizationException {
return engineCanonicalizeSubTree(rootNode, (Node)null);
}
-
+
/**
* Method engineCanonicalizeXPathNodeSet
* @inheritDoc
@@ -165,7 +165,7 @@ public abstract class CanonicalizerBase
throw new CanonicalizationException(ex);
}
}
-
+
/**
* @param writer The writer to set.
*/
@@ -175,7 +175,7 @@ public abstract class CanonicalizerBase
/**
* Canonicalizes a Subtree node.
- *
+ *
* @param rootNode
* the root of the subtree to canonicalize
* @param excludeNode
@@ -193,13 +193,13 @@ public abstract class CanonicalizerBase
//Fills the nssymbtable with the definitions of the parent of the root subnode
getParentNameSpaces((Element)rootNode, ns);
nodeLevel = NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
- }
+ }
this.canonicalizeSubTree(rootNode, ns, rootNode, nodeLevel);
this.writer.flush();
if (this.writer instanceof ByteArrayOutputStream) {
byte[] result = ((ByteArrayOutputStream)this.writer).toByteArray();
if (reset) {
- ((ByteArrayOutputStream)this.writer).reset();
+ ((ByteArrayOutputStream)this.writer).reset();
} else {
this.writer.close();
}
@@ -207,7 +207,7 @@ public abstract class CanonicalizerBase
} else if (this.writer instanceof UnsyncByteArrayOutputStream) {
byte[] result = ((UnsyncByteArrayOutputStream)this.writer).toByteArray();
if (reset) {
- ((UnsyncByteArrayOutputStream)this.writer).reset();
+ ((UnsyncByteArrayOutputStream)this.writer).reset();
} else {
this.writer.close();
}
@@ -221,16 +221,16 @@ public abstract class CanonicalizerBase
throw new CanonicalizationException(ex);
} catch (IOException ex) {
throw new CanonicalizationException(ex);
- }
+ }
}
/**
* Method canonicalizeSubTree, this function is a recursive one.
- *
+ *
* @param currentNode
- * @param ns
- * @param endnode
+ * @param ns
+ * @param endnode
* @throws CanonicalizationException
* @throws IOException
*/
@@ -242,7 +242,7 @@ public abstract class CanonicalizerBase
}
Node sibling = null;
Node parentNode = null;
- final OutputStream writer = this.writer;
+ final OutputStream writer = this.writer;
final Node excludeNode = this.excludeNode;
final boolean includeComments = this.includeComments;
Map<String, byte[]> cache = new HashMap<String, byte[]>();
@@ -253,7 +253,7 @@ public abstract class CanonicalizerBase
case Node.NOTATION_NODE :
case Node.ATTRIBUTE_NODE :
// illegal node type during traversal
- throw new CanonicalizationException("empty",
+ throw new CanonicalizationException("empty",
new Object[]{"illegal node type during traversal"});
case Node.DOCUMENT_FRAGMENT_NODE :
@@ -281,7 +281,7 @@ public abstract class CanonicalizerBase
documentLevel = NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
if (currentNode == excludeNode) {
break;
- }
+ }
Element currentElement = (Element)currentNode;
//Add a level to the nssymbtable. So latter can be pop-back.
ns.outputNodePush();
@@ -297,11 +297,11 @@ public abstract class CanonicalizerBase
outputAttrToWriter(attr.getNodeName(), attr.getNodeValue(), writer, cache);
}
}
- writer.write('>');
- sibling = currentNode.getFirstChild();
+ writer.write('>');
+ sibling = currentNode.getFirstChild();
if (sibling == null) {
writer.write(END_TAG.clone());
- UtfHelpper.writeStringToUtf8(name, writer);
+ UtfHelpper.writeStringToUtf8(name, writer);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
@@ -312,14 +312,14 @@ public abstract class CanonicalizerBase
parentNode = currentElement;
}
break;
-
+
case Node.DOCUMENT_TYPE_NODE :
default :
break;
}
while (sibling == null && parentNode != null) {
writer.write(END_TAG.clone());
- UtfHelpper.writeByte(((Element)parentNode).getTagName(), writer, cache);
+ UtfHelpper.writeByte(((Element)parentNode).getTagName(), writer, cache);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
@@ -332,19 +332,19 @@ public abstract class CanonicalizerBase
documentLevel = NODE_AFTER_DOCUMENT_ELEMENT;
parentNode = null;
}
- }
+ }
if (sibling == null) {
return;
}
- currentNode = sibling;
+ currentNode = sibling;
sibling = currentNode.getNextSibling();
} while(true);
}
private byte[] engineCanonicalizeXPathNodeSetInternal(Node doc)
- throws CanonicalizationException {
- try {
+ throws CanonicalizationException {
+ try {
this.canonicalizeXPathNodeSet(doc, doc);
this.writer.flush();
if (this.writer instanceof ByteArrayOutputStream) {
@@ -358,7 +358,7 @@ public abstract class CanonicalizerBase
} else if (this.writer instanceof UnsyncByteArrayOutputStream) {
byte[] result = ((UnsyncByteArrayOutputStream)this.writer).toByteArray();
if (reset) {
- ((UnsyncByteArrayOutputStream)this.writer).reset();
+ ((UnsyncByteArrayOutputStream)this.writer).reset();
} else {
this.writer.close();
}
@@ -371,11 +371,11 @@ public abstract class CanonicalizerBase
throw new CanonicalizationException(ex);
} catch (IOException ex) {
throw new CanonicalizationException(ex);
- }
+ }
}
/**
- * Canonicalizes all the nodes included in the currentNode and contained in the
+ * Canonicalizes all the nodes included in the currentNode and contained in the
* xpathNodeSet field.
*
* @param currentNode
@@ -388,7 +388,7 @@ public abstract class CanonicalizerBase
if (isVisibleInt(currentNode) == -1) {
return;
}
- boolean currentNodeIsVisible = false;
+ boolean currentNodeIsVisible = false;
NameSpaceSymbTable ns = new NameSpaceSymbTable();
if (currentNode != null && Node.ELEMENT_NODE == currentNode.getNodeType()) {
getParentNameSpaces((Element)currentNode, ns);
@@ -475,12 +475,12 @@ public abstract class CanonicalizerBase
if (currentNodeIsVisible) {
writer.write('>');
}
- sibling = currentNode.getFirstChild();
+ sibling = currentNode.getFirstChild();
if (sibling == null) {
if (currentNodeIsVisible) {
writer.write(END_TAG.clone());
- UtfHelpper.writeByte(name, writer, cache);
+ UtfHelpper.writeByte(name, writer, cache);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
@@ -494,15 +494,15 @@ public abstract class CanonicalizerBase
parentNode = currentElement;
}
break;
-
+
case Node.DOCUMENT_TYPE_NODE :
default :
break;
}
- while (sibling == null && parentNode != null) {
+ while (sibling == null && parentNode != null) {
if (isVisible(parentNode)) {
writer.write(END_TAG.clone());
- UtfHelpper.writeByte(((Element)parentNode).getTagName(), writer, cache);
+ UtfHelpper.writeByte(((Element)parentNode).getTagName(), writer, cache);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
@@ -513,20 +513,20 @@ public abstract class CanonicalizerBase
return;
}
sibling = parentNode.getNextSibling();
- parentNode = parentNode.getParentNode();
+ parentNode = parentNode.getParentNode();
if (parentNode == null || Node.ELEMENT_NODE != parentNode.getNodeType()) {
parentNode = null;
documentLevel = NODE_AFTER_DOCUMENT_ELEMENT;
}
- }
+ }
if (sibling == null) {
return;
}
- currentNode = sibling;
- sibling = currentNode.getNextSibling();
+ currentNode = sibling;
+ sibling = currentNode.getNextSibling();
} while(true);
}
-
+
protected int isVisibleDO(Node currentNode, int level) {
if (nodeFilter != null) {
Iterator<NodeFilter> it = nodeFilter.iterator();
@@ -542,7 +542,7 @@ public abstract class CanonicalizerBase
}
return 1;
}
-
+
protected int isVisibleInt(Node currentNode) {
if (nodeFilter != null) {
Iterator<NodeFilter> it = nodeFilter.iterator();
@@ -584,7 +584,7 @@ public abstract class CanonicalizerBase
Attr attribute = (Attr) attrs.item(i);
String NName = attribute.getLocalName();
String NValue = attribute.getNodeValue();
-
+
if (Constants.NamespaceSpecNS.equals(attribute.getNamespaceURI())
&& (!XML.equals(NName) || !Constants.XML_LANG_SPACE_SpecNS.equals(NValue))) {
ns.addMapping(NName, NValue, attribute);
@@ -636,9 +636,9 @@ public abstract class CanonicalizerBase
XMLNS, "", getNullNode(nsprefix.getOwnerDocument()));
}
}
-
+
/**
- * Obtain the attributes to output for this node in XPathNodeSet c14n.
+ * Obtain the attributes to output for this node in XPathNodeSet c14n.
*
* @param element
* @param ns
@@ -659,7 +659,7 @@ public abstract class CanonicalizerBase
abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException;
- abstract void circumventBugIfNeeded(XMLSignatureInput input)
+ abstract void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException, IOException, SAXException;
/**
@@ -678,11 +678,11 @@ public abstract class CanonicalizerBase
*
* @param name
* @param value
- * @param writer
+ * @param writer
* @throws IOException
*/
protected static final void outputAttrToWriter(
- final String name, final String value,
+ final String name, final String value,
final OutputStream writer, final Map<String, byte[]> cache
) throws IOException {
writer.write(' ');
@@ -691,7 +691,7 @@ public abstract class CanonicalizerBase
byte[] toWrite;
final int length = value.length();
int i = 0;
- while (i < length) {
+ while (i < length) {
int c = value.codePointAt(i);
i += Character.charCount(c);
@@ -744,7 +744,7 @@ public abstract class CanonicalizerBase
*/
protected void outputPItoWriter(
ProcessingInstruction currentPI, OutputStream writer, int position
- ) throws IOException {
+ ) throws IOException {
if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
writer.write('\n');
}
@@ -763,7 +763,7 @@ public abstract class CanonicalizerBase
writer.write(c);
} else {
UtfHelpper.writeCodePointToUtf8(c, writer);
- }
+ }
}
}
@@ -800,14 +800,14 @@ public abstract class CanonicalizerBase
*/
protected void outputCommentToWriter(
Comment currentComment, OutputStream writer, int position
- ) throws IOException {
+ ) throws IOException {
if (position == NODE_AFTER_DOCUMENT_ELEMENT) {
writer.write('\n');
}
writer.write(BEGIN_COMM.clone());
final String data = currentComment.getData();
- final int length = data.length();
+ final int length = data.length();
for (int i = 0; i < length; ) {
int c = data.codePointAt(i);
@@ -819,8 +819,8 @@ public abstract class CanonicalizerBase
writer.write(c);
} else {
UtfHelpper.writeCodePointToUtf8(c, writer);
- }
- }
+ }
+ }
}
writer.write(END_COMM.clone());
@@ -887,6 +887,6 @@ public abstract class CanonicalizerBase
}
}
return nullNode;
- }
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerPhysical.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerPhysical.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerPhysical.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/CanonicalizerPhysical.java Tue Dec 15 17:13:17 2015
@@ -123,16 +123,16 @@ public class CanonicalizerPhysical exten
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException {
if (!element.hasAttributes()) {
- return null;
+ return null;
}
// result will contain all the attrs declared directly on that element
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
- int attrsLength = attrs.getLength();
+ int attrsLength = attrs.getLength();
for (int i = 0; i < attrsLength; i++) {
Attr attribute = (Attr) attrs.item(i);
@@ -145,21 +145,21 @@ public class CanonicalizerPhysical exten
/**
* Returns the Attr[]s to be output for the given element.
- *
+ *
* @param element
* @param ns
* @return the Attr[]s to be output
* @throws CanonicalizationException
*/
@Override
- protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
- throws CanonicalizationException {
+ protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
+ throws CanonicalizationException {
/** $todo$ well, should we throw UnsupportedOperationException ? */
throw new CanonicalizationException("c14n.Canonicalizer.UnsupportedOperation");
}
- protected void circumventBugIfNeeded(XMLSignatureInput input)
+ protected void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
// nothing to do
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/NameSpaceSymbTable.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/NameSpaceSymbTable.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/NameSpaceSymbTable.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/NameSpaceSymbTable.java Tue Dec 15 17:13:17 2015
@@ -37,20 +37,20 @@ public class NameSpaceSymbTable {
private static final String XMLNS = "xmlns";
private static final SymbMap initialMap = new SymbMap();
-
+
static {
NameSpaceSymbEntry ne = new NameSpaceSymbEntry("", null, true, XMLNS);
ne.lastrendered = "";
initialMap.put(XMLNS, ne);
}
-
+
/**The map betwen prefix-> entry table. */
private SymbMap symb;
-
+
/**The stacks for removing the definitions when doing pop.*/
private List<SymbMap> level;
private boolean cloned = true;
-
+
/**
* Default constractor
**/
@@ -64,26 +64,26 @@ public class NameSpaceSymbTable {
* Get all the unrendered nodes in the name space.
* For Inclusive rendering
* @param result the list where to fill the unrendered xmlns definitions.
- **/
+ **/
public void getUnrenderedNodes(Collection<Attr> result) {
Iterator<NameSpaceSymbEntry> it = symb.entrySet().iterator();
- while (it.hasNext()) {
+ while (it.hasNext()) {
NameSpaceSymbEntry n = it.next();
//put them rendered?
if (!n.rendered && n.n != null) {
n = (NameSpaceSymbEntry) n.clone();
needsClone();
- symb.put(n.prefix, n);
+ symb.put(n.prefix, n);
n.lastrendered = n.uri;
n.rendered = true;
result.add(n.n);
}
- }
+ }
}
/**
- * Push a frame for visible namespace.
+ * Push a frame for visible namespace.
* For Inclusive rendering.
**/
public void outputNodePush() {
@@ -117,7 +117,7 @@ public class NameSpaceSymbTable {
if (ob != null) {
symb = (SymbMap)ob;
if (size == 0) {
- cloned = false;
+ cloned = false;
} else {
cloned = level.get(size - 1) != symb;
}
@@ -136,7 +136,7 @@ public class NameSpaceSymbTable {
/**
- * Gets the attribute node that defines the binding for the prefix.
+ * Gets the attribute node that defines the binding for the prefix.
* @param prefix the prefix to obtain the attribute.
* @return null if there is no need to render the prefix. Otherwise the node of
* definition.
@@ -162,14 +162,14 @@ public class NameSpaceSymbTable {
}
/**
- * Gets a definition without mark it as render.
+ * Gets a definition without mark it as render.
* For render in exclusive c14n the namespaces in the include prefixes.
* @param prefix The prefix whose definition is neaded.
* @return the attr to render, null if there is no need to render
**/
public Attr getMappingWithoutRendered(String prefix) {
NameSpaceSymbEntry entry = symb.get(prefix);
- if (entry == null) {
+ if (entry == null) {
return null;
}
if (entry.rendered) {
@@ -215,20 +215,20 @@ public class NameSpaceSymbTable {
* @param n the attribute that have the definition
* @return the attr to render, null if there is no need to render
**/
- public Node addMappingAndRender(String prefix, String uri, Attr n) {
+ public Node addMappingAndRender(String prefix, String uri, Attr n) {
NameSpaceSymbEntry ob = symb.get(prefix);
if (ob != null && uri.equals(ob.uri)) {
- if (!ob.rendered) {
+ if (!ob.rendered) {
ob = (NameSpaceSymbEntry) ob.clone();
needsClone();
- symb.put(prefix, ob);
+ symb.put(prefix, ob);
ob.lastrendered = uri;
ob.rendered = true;
return ob.n;
- }
+ }
return null;
- }
+ }
NameSpaceSymbEntry ne = new NameSpaceSymbEntry(uri,n,true,prefix);
ne.lastrendered = uri;
@@ -250,7 +250,7 @@ public class NameSpaceSymbTable {
if (ob != null) {
needsClone();
- symb.put(prefix, null);
+ symb.put(prefix, null);
}
}
@@ -259,7 +259,7 @@ public class NameSpaceSymbTable {
if (ob != null && !ob.rendered) {
needsClone();
- symb.put(prefix, null);
+ symb.put(prefix, null);
}
}
@@ -268,7 +268,7 @@ public class NameSpaceSymbTable {
if (ob != null && ob.rendered) {
needsClone();
- symb.put(prefix, null);
+ symb.put(prefix, null);
}
return false;
}
@@ -278,30 +278,30 @@ public class NameSpaceSymbTable {
* The internal structure of NameSpaceSymbTable.
**/
class NameSpaceSymbEntry implements Cloneable {
-
+
String prefix;
-
+
/**The URI that the prefix defines */
String uri;
-
+
/**The last output in the URI for this prefix (This for speed reason).*/
String lastrendered = null;
-
+
/**This prefix-URI has been already render or not.*/
boolean rendered = false;
-
+
/**The attribute to include.*/
- Attr n;
-
+ Attr n;
+
NameSpaceSymbEntry(String name, Attr n, boolean rendered, String prefix) {
- this.uri = name;
+ this.uri = name;
this.rendered = rendered;
- this.n = n;
+ this.n = n;
this.prefix = prefix;
}
-
+
/** @inheritDoc */
- public Object clone() {
+ public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
@@ -314,18 +314,18 @@ class SymbMap implements Cloneable {
int free = 23;
NameSpaceSymbEntry[] entries;
String[] keys;
-
+
SymbMap() {
entries = new NameSpaceSymbEntry[free];
keys = new String[free];
}
-
+
void put(String key, NameSpaceSymbEntry value) {
int index = index(key);
Object oldKey = keys[index];
keys[index] = key;
entries[index] = value;
- if ((oldKey == null || !oldKey.equals(key)) && --free == 0) {
+ if ((oldKey == null || !oldKey.equals(key)) && --free == 0) {
free = entries.length;
int newCapacity = free << 2;
rehash(newCapacity);
@@ -356,7 +356,7 @@ class SymbMap implements Cloneable {
do {
index = index == length ? 0 : ++index;
cur = set[index];
- } while (cur != null && !cur.equals(obj));
+ } while (cur != null && !cur.equals(obj));
return index;
}
@@ -370,7 +370,7 @@ class SymbMap implements Cloneable {
String oldKeys[] = keys;
NameSpaceSymbEntry oldVals[] = entries;
- keys = new String[newCapacity];
+ keys = new String[newCapacity];
entries = new NameSpaceSymbEntry[newCapacity];
for (int i = oldCapacity; i-- > 0;) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/UtfHelpper.java Tue Dec 15 17:13:17 2015
@@ -27,9 +27,9 @@ import java.util.Map;
public final class UtfHelpper {
/**
- * Revert to the old behavior (version 2 or before), i.e. surrogate pairs characters becomes
+ * Revert to the old behavior (version 2 or before), i.e. surrogate pairs characters becomes
* '??' in output. Set system property org.apache.xml.security.c14n.oldUtf8=true if you want
- * to verify signatures generated by version 2 or before that contains 32 bit chars in the
+ * to verify signatures generated by version 2 or before that contains 32 bit chars in the
* XML document.
*/
private static final boolean OLD_UTF8 =
@@ -106,7 +106,7 @@ public final class UtfHelpper {
out.write(0x3f);
return;
}
-
+
byte write;
int shift = 6 * extraByte;
write = (byte)((0xFE << (6 - extraByte)) | (c >>> shift));
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AbstractSerializer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AbstractSerializer.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AbstractSerializer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AbstractSerializer.java Tue Dec 15 17:13:17 2015
@@ -33,18 +33,18 @@ import org.w3c.dom.NodeList;
/**
* Converts <code>String</code>s into <code>Node</code>s and visa versa.
- *
+ *
* An abstract class for common Serializer functionality
*/
public abstract class AbstractSerializer implements Serializer {
-
+
protected Canonicalizer canon;
protected boolean secureValidation;
-
+
public void setCanonicalizer(Canonicalizer canon) {
this.canon = canon;
}
-
+
/**
* Returns a <code>String</code> representation of the specified
* <code>Element</code>.
@@ -89,7 +89,7 @@ public abstract class AbstractSerializer
* them to the document fragment.
* <p/>
* Refer also to comments about setup of format.
- *
+ *
* @param content the <code>NodeList</code> to serialize.
* @return the <code>String</code> representation of the serialized
* <code>NodeList</code>.
@@ -100,8 +100,8 @@ public abstract class AbstractSerializer
canon.setSecureValidation(secureValidation);
canon.setWriter(baos);
canon.notReset();
- for (int i = 0; i < content.getLength(); i++) {
- canon.canonicalizeSubtree(content.item(i));
+ for (int i = 0; i < content.getLength(); i++) {
+ canon.canonicalizeSubtree(content.item(i));
}
String ret = baos.toString("UTF-8");
baos.reset();
@@ -111,7 +111,7 @@ public abstract class AbstractSerializer
/**
* Returns a <code>byte[]</code> representation of the specified
* <code>NodeList</code>.
- *
+ *
* @param content the <code>NodeList</code> to serialize.
* @return the <code>byte[]</code> representation of the serialized
* <code>NodeList</code>.
@@ -133,13 +133,13 @@ public abstract class AbstractSerializer
* @param node
* @return the canonicalization of the node
* @throws Exception
- */
+ */
public String canonSerialize(Node node) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
canon.setSecureValidation(secureValidation);
- canon.setWriter(baos);
+ canon.setWriter(baos);
canon.notReset();
- canon.canonicalizeSubtree(node);
+ canon.canonicalizeSubtree(node);
String ret = baos.toString("UTF-8");
baos.reset();
return ret;
@@ -150,7 +150,7 @@ public abstract class AbstractSerializer
* @param node
* @return the (byte[]) canonicalization of the node
* @throws Exception
- */
+ */
public byte[] canonSerializeToByteArray(Node node) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
canon.setSecureValidation(secureValidation);
@@ -219,7 +219,7 @@ public abstract class AbstractSerializer
throw new XMLEncryptionException(e);
}
}
-
+
protected static String createContext(String source, Node ctx) {
// Create the context to parse the document against
StringBuilder sb = new StringBuilder();
@@ -260,5 +260,5 @@ public abstract class AbstractSerializer
public void setSecureValidation(boolean secureValidation) {
this.secureValidation = secureValidation;
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AgreementMethod.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AgreementMethod.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AgreementMethod.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/AgreementMethod.java Tue Dec 15 17:13:17 2015
@@ -75,7 +75,7 @@ import org.w3c.dom.Element;
* @author Axl Mattheus
*/
public interface AgreementMethod {
-
+
/**
* Returns a <code>byte</code> array.
* @return a <code>byte</code> array.
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/CipherData.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/CipherData.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/CipherData.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/CipherData.java Tue Dec 15 17:13:17 2015
@@ -39,10 +39,10 @@ package org.apache.xml.security.encrypti
* @author Axl Mattheus
*/
public interface CipherData {
-
+
/** VALUE_TYPE ASN */
int VALUE_TYPE = 0x00000001;
-
+
/** REFERENCE_TYPE ASN */
int REFERENCE_TYPE = 0x00000002;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/DocumentSerializer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/DocumentSerializer.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/DocumentSerializer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/DocumentSerializer.java Tue Dec 15 17:13:17 2015
@@ -37,7 +37,7 @@ import org.xml.sax.SAXException;
* Converts <code>String</code>s into <code>Node</code>s and visa versa.
*/
public class DocumentSerializer extends AbstractSerializer {
-
+
/**
* @param source
* @param ctx
@@ -48,7 +48,7 @@ public class DocumentSerializer extends
byte[] fragment = createContext(source, ctx);
return deserialize(ctx, new InputSource(new ByteArrayInputStream(fragment)));
}
-
+
/**
* @param source
* @param ctx
@@ -59,7 +59,7 @@ public class DocumentSerializer extends
String fragment = createContext(source, ctx);
return deserialize(ctx, new InputSource(new StringReader(fragment)));
}
-
+
/**
* @param ctx
* @param inputSource
@@ -101,5 +101,5 @@ public class DocumentSerializer extends
}
}
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedKey.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedKey.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedKey.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedKey.java Tue Dec 15 17:13:17 2015
@@ -47,7 +47,7 @@ package org.apache.xml.security.encrypti
* @author Axl Mattheus
*/
public interface EncryptedKey extends EncryptedType {
-
+
/**
* Returns a hint as to which recipient this encrypted key value is intended for.
*
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedType.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedType.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedType.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptedType.java Tue Dec 15 17:13:17 2015
@@ -46,7 +46,7 @@ import org.apache.xml.security.keys.KeyI
* @author Axl Mattheus
*/
public interface EncryptedType {
-
+
/**
* Returns a <code>String</code> providing for the standard method of
* assigning an id to the element within the document context.
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionMethod.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionMethod.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionMethod.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionMethod.java Tue Dec 15 17:13:17 2015
@@ -77,25 +77,25 @@ public interface EncryptionMethod {
* @param parameters the OAEP parameters.
*/
void setOAEPparams(byte[] parameters);
-
+
/**
* Set the Digest Algorithm to use
* @param digestAlgorithm the Digest Algorithm to use
*/
void setDigestAlgorithm(String digestAlgorithm);
-
+
/**
* Get the Digest Algorithm to use
* @return the Digest Algorithm to use
*/
String getDigestAlgorithm();
-
+
/**
* Set the MGF Algorithm to use
* @param mgfAlgorithm the MGF Algorithm to use
*/
void setMGFAlgorithm(String mgfAlgorithm);
-
+
/**
* Get the MGF Algorithm to use
* @return the MGF Algorithm to use
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperties.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperties.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperties.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperties.java Tue Dec 15 17:13:17 2015
@@ -42,7 +42,7 @@ import java.util.Iterator;
* @author Axl Mattheus
*/
public interface EncryptionProperties {
-
+
/**
* Returns the <code>EncryptionProperties</code>' id.
*
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperty.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperty.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperty.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/EncryptionProperty.java Tue Dec 15 17:13:17 2015
@@ -47,7 +47,7 @@ import org.w3c.dom.Element;
* @author Axl Mattheus
*/
public interface EncryptionProperty {
-
+
/**
* Returns the <code>EncryptedType</code> being described.
*
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/ReferenceList.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/ReferenceList.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/ReferenceList.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/ReferenceList.java Tue Dec 15 17:13:17 2015
@@ -41,10 +41,10 @@ import java.util.Iterator;
* @see Reference
*/
public interface ReferenceList {
-
+
/** DATA TAG */
int DATA_REFERENCE = 0x00000001;
-
+
/** KEY TAG */
int KEY_REFERENCE = 0x00000002;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/Serializer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/Serializer.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/Serializer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/Serializer.java Tue Dec 15 17:13:17 2015
@@ -27,12 +27,12 @@ import org.w3c.dom.NodeList;
* Converts <code>String</code>s into <code>Node</code>s and visa versa.
*/
public interface Serializer {
-
+
/**
* Set the Canonicalizer object to use.
*/
void setCanonicalizer(Canonicalizer canon);
-
+
/**
* Returns a <code>byte[]</code> representation of the specified
* <code>Element</code>.
@@ -47,7 +47,7 @@ public interface Serializer {
/**
* Returns a <code>byte[]</code> representation of the specified
* <code>NodeList</code>.
- *
+ *
* @param content the <code>NodeList</code> to serialize.
* @return the <code>byte[]</code> representation of the serialized
* <code>NodeList</code>.
@@ -60,7 +60,7 @@ public interface Serializer {
* @param node
* @return the (byte[]) canonicalization of the node
* @throws Exception
- */
+ */
byte[] canonSerializeToByteArray(Node node) throws Exception;
/**
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/TransformSerializer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/TransformSerializer.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/TransformSerializer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/TransformSerializer.java Tue Dec 15 17:13:17 2015
@@ -33,11 +33,11 @@ import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Node;
/**
- * Converts <code>String</code>s into <code>Node</code>s and visa versa. This requires Xalan to
+ * Converts <code>String</code>s into <code>Node</code>s and visa versa. This requires Xalan to
* work properly.
*/
public class TransformSerializer extends AbstractSerializer {
-
+
private TransformerFactory transformerFactory;
/**
@@ -50,7 +50,7 @@ public class TransformSerializer extends
byte[] fragment = createContext(source, ctx);
return deserialize(ctx, new StreamSource(new ByteArrayInputStream(fragment)));
}
-
+
/**
* @param source
* @param ctx
@@ -61,7 +61,7 @@ public class TransformSerializer extends
String fragment = createContext(source, ctx);
return deserialize(ctx, new StreamSource(new StringReader(fragment)));
}
-
+
/**
* @param ctx
* @param source
@@ -76,13 +76,13 @@ public class TransformSerializer extends
} else {
contextDocument = ctx.getOwnerDocument();
}
-
+
if (transformerFactory == null) {
transformerFactory = TransformerFactory.newInstance();
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
}
Transformer transformer = transformerFactory.newTransformer();
-
+
DOMResult res = new DOMResult();
Node placeholder = contextDocument.createDocumentFragment();
@@ -104,7 +104,7 @@ public class TransformSerializer extends
docfrag.appendChild(child);
child = dummyChild.getFirstChild();
}
-
+
return docfrag;
} catch (Exception e) {
throw new XMLEncryptionException(e);