From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 22 Mar 2021 18:40:26 +0100 Subject: change to EGIZ codestyle --- .../server/iaik/xml/Base64TransformationImpl.java | 29 +- .../server/iaik/xml/ByteArrayDataObjectImpl.java | 27 +- .../server/iaik/xml/ByteStreamDataObjectImpl.java | 18 +- .../spss/server/iaik/xml/CanonicalizationImpl.java | 27 +- .../moa/spss/server/iaik/xml/DataObjectImpl.java | 25 +- .../xml/EnvelopedSignatureTransformationImpl.java | 22 +- .../iaik/xml/ExclusiveCanonicalizationImpl.java | 53 ++-- .../moa/spss/server/iaik/xml/SigningTimeImpl.java | 12 +- .../spss/server/iaik/xml/TransformationImpl.java | 15 +- .../spss/server/iaik/xml/XMLDataObjectImpl.java | 21 +- .../server/iaik/xml/XMLNodeListDataObjectImpl.java | 14 +- .../moa/spss/server/iaik/xml/XMLSignatureImpl.java | 14 +- .../moa/spss/server/iaik/xml/XPath2FilterImpl.java | 45 +-- .../server/iaik/xml/XPath2TransformationImpl.java | 31 +- .../server/iaik/xml/XPathTransformationImpl.java | 43 +-- .../server/iaik/xml/XSLTTransformationImpl.java | 350 ++++++++++----------- 16 files changed, 373 insertions(+), 373 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java index cc12861..1bba712 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/Base64TransformationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Base64Transformation; @@ -29,39 +28,39 @@ import iaik.server.modules.xml.Base64Transformation; /** * An implementation of the Base64Transformation * Transformation type. - * + * * @author Patrick Peck * @version $Id$ */ public class Base64TransformationImpl - extends TransformationImpl - implements Base64Transformation { - + extends TransformationImpl + implements Base64Transformation { + /** * Create a new Base64TransformationImpl. - * + * * @see java.lang.Object#Object() - */ + */ public Base64TransformationImpl() { setAlgorithmURI(Base64Transformation.BASE64_DECODING); } /** * Compare this Base64Transformation to another. - * - * @param other The object to compare thisBase64Transformation - * to. + * + * @param other The object to compare thisBase64Transformation to. * @return true, if other is a - * Base64Transformation and the algorithm URIs match, otherwise - * false. + * Base64Transformation and the algorithm URIs match, + * otherwise false. * @see java.lang.Object#equals(Object) - */ + */ + @Override public boolean equals(Object other) { if (other instanceof Base64Transformation) { - Base64Transformation transform = (Base64Transformation) other; + final Base64Transformation transform = (Base64Transformation) other; return getAlgorithmURI().equals(transform.getAlgorithmURI()); } return false; } - + } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java index 4d627d7..e498842 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteArrayDataObjectImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.io.ByteArrayInputStream; @@ -31,22 +30,21 @@ import iaik.server.modules.xml.BinaryDataObject; /** * A BinaryDataObject encapsulating Base64 data. - * + * * @author Patrick Peck * @version $Id$ */ public class ByteArrayDataObjectImpl - extends DataObjectImpl - implements BinaryDataObject { + extends DataObjectImpl + implements BinaryDataObject { /** The binary data contained in this BinaryDataObject. */ private byte[] bytes; /** * Create a new ByteArrayDataObjectImpl. - * - * @param bytes The binary data contained in this - * BinaryDataObject. + * + * @param bytes The binary data contained in this BinaryDataObject. */ public ByteArrayDataObjectImpl(byte[] bytes) { setBytes(bytes); @@ -54,23 +52,22 @@ public class ByteArrayDataObjectImpl /** * Set the Base64 data. - * - * @param bytes The binary data contained in this - * BinaryDataObject. + * + * @param bytes The binary data contained in this BinaryDataObject. */ public void setBytes(byte[] bytes) { this.bytes = bytes; } /** - * Return the binary data encoded in the Base64 String as a - * stream. - * + * Return the binary data encoded in the Base64 String as a stream. + * * @return The binary data contained in this object, as a - * InputStream. Repeated calls to this function will return a - * new stream to the Base64 data. + * InputStream. Repeated calls to this function will return + * a new stream to the Base64 data. * @see iaik.server.modules.xml.BinaryDataObject#getInputStream() */ + @Override public InputStream getInputStream() { return new ByteArrayInputStream(bytes); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java index b982c8e..af8ee66 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ByteStreamDataObjectImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.io.InputStream; @@ -29,21 +28,21 @@ import java.io.InputStream; import iaik.server.modules.xml.BinaryDataObject; /** - * A BinaryDataObject encapsulating binary data from a stream. - * + * A BinaryDataObject encapsulating binary data from a stream. + * * @author Patrick Peck * @version $Id$ */ public class ByteStreamDataObjectImpl - extends DataObjectImpl - implements BinaryDataObject { + extends DataObjectImpl + implements BinaryDataObject { /** The InputStream containing the binary data. */ private InputStream inputStream; /** * Create a new ByteStreamDataObjectImpl. - * + * * @param inputStream The stream from which to read the binary data. */ public ByteStreamDataObjectImpl(InputStream inputStream) { @@ -52,7 +51,7 @@ public class ByteStreamDataObjectImpl /** * Set the input stream from which to read the binary data. - * + * * @param inputStream The input stream from which to read the binary data. */ public void setInputStream(InputStream inputStream) { @@ -61,11 +60,12 @@ public class ByteStreamDataObjectImpl /** * Return the binary data from this object as a stream. - * + * * @return The stream containing the binary data. Calling this function - * repeatedly will always return the same InputStream. + * repeatedly will always return the same InputStream. * @see iaik.server.modules.xml.BinaryDataObject#getInputStream() */ + @Override public InputStream getInputStream() { return inputStream; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java index 0c3a8da..1e2a651 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/CanonicalizationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Canonicalization; @@ -29,36 +28,36 @@ import iaik.server.modules.xml.Canonicalization; /** * An implementation of the CanonicalizationTransform * Transformation type. - * + * * @author Patrick Peck * @version $Id$ */ public class CanonicalizationImpl - extends TransformationImpl - implements Canonicalization { - + extends TransformationImpl + implements Canonicalization { + /** * Create a new CanonicalizationTransformImpl object. - * + * * @param algorithmURI The canonicalization algorithm URI. - */ + */ public CanonicalizationImpl(String algorithmURI) { setAlgorithmURI(algorithmURI); } - + /** * Compare this object to another Canonicalization. - * - * @param other The object to compare this - * Canonicalization to. + * + * @param other The object to compare this Canonicalization to. * @return true, if other is a - * Canonicalization and the algorithm URIs match, otherwise - * false. + * Canonicalization and the algorithm URIs match, otherwise + * false. * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object other) { if (other instanceof Canonicalization) { - Canonicalization c14n = (Canonicalization) other; + final Canonicalization c14n = (Canonicalization) other; return getAlgorithmURI().equals(c14n.getAlgorithmURI()); } return false; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java index 702caaf..ac36875 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/DataObjectImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.DataObject; @@ -29,12 +28,12 @@ import iaik.server.modules.xml.DataObject; /** * Abstract base implementation for the classes derived from * DataObject. - * + * * @author Patrick Peck * @version $Id$ */ public abstract class DataObjectImpl implements DataObject { - + /** The MIME type of the data object. */ private String mimeType; /** The refernce ID. */ @@ -43,33 +42,35 @@ public abstract class DataObjectImpl implements DataObject { private String typeURI; /** The URI identifying the data. */ private String URI; - + /** * @see iaik.server.modules.xml.DataObject#getMimeType() */ + @Override public String getMimeType() { return mimeType; } /** * Set the mime type. - * + * * @param mimeType The mime type to set. */ public void setMimeType(String mimeType) { this.mimeType = mimeType; } - + /** * @see iaik.server.modules.xml.DataObject#getReferenceID() */ + @Override public String getReferenceID() { return referenceID; } - + /** * Set the reference ID. - * + * * @param referenceID The reference ID. */ public void setReferenceID(String referenceID) { @@ -79,13 +80,14 @@ public abstract class DataObjectImpl implements DataObject { /** * @see iaik.server.modules.xml.DataObject#getTypeURI() */ + @Override public String getTypeURI() { return typeURI; } /** * Set the type URI. - * + * * @param typeURI The type URI. */ public void setTypeURI(String typeURI) { @@ -95,13 +97,14 @@ public abstract class DataObjectImpl implements DataObject { /** * @see iaik.server.modules.xml.DataObject#getURI() */ + @Override public String getURI() { return URI; } - + /** * Set the URI. - * + * * @param URI The URI. */ public void setURI(String URI) { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java index d582594..2c9f0e3 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/EnvelopedSignatureTransformationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.EnvelopedSignatureTransformation; @@ -29,13 +28,13 @@ import iaik.server.modules.xml.EnvelopedSignatureTransformation; /** * An implementation of the EnvelopedSignatureTransformation * Transformation type. - * + * * @author Patrick Peck * @version $Id$ */ public class EnvelopedSignatureTransformationImpl - extends TransformationImpl - implements EnvelopedSignatureTransformation { + extends TransformationImpl + implements EnvelopedSignatureTransformation { /** * Create a new EnvelopedSignatureTransformationImpl. @@ -46,18 +45,19 @@ public class EnvelopedSignatureTransformationImpl /** * Compare this object to another EnvelopedSignatureTransformation. - * - * @param other The object to compare this - * EnvelopedSignatureTransformation to. + * + * @param other The object to compare this + * EnvelopedSignatureTransformation to. * @return true, if other is a - * EnvelopedSignatureTransformation, otherwise - * false. + * EnvelopedSignatureTransformation, otherwise + * false. * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object other) { if (other instanceof EnvelopedSignatureTransformation) { - EnvelopedSignatureTransformation transform = - (EnvelopedSignatureTransformation) other; + final EnvelopedSignatureTransformation transform = + (EnvelopedSignatureTransformation) other; return getAlgorithmURI().equals(transform.getAlgorithmURI()); } return false; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java index dfadf0c..ce98e7f 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/ExclusiveCanonicalizationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.List; @@ -29,38 +28,39 @@ import java.util.List; import iaik.server.modules.xml.ExclusiveCanonicalization; /** - * An implementation of the ExclusiveCanonicalization type - * of Transformation. - * + * An implementation of the ExclusiveCanonicalization type of + * Transformation. + * * @author Patrick Peck * @version $Id$ */ public class ExclusiveCanonicalizationImpl - extends TransformationImpl - implements ExclusiveCanonicalization { + extends TransformationImpl + implements ExclusiveCanonicalization { /** The prefixes of the namespaces to treat according to canonical XML. */ private List inclusiveNamespacePrefixes; /** * Create a new ExclusiveCanonicalizationImpl object. - * - * @param algorithmURI The exclusive canonicalization algorithm URI. + * + * @param algorithmURI The exclusive canonicalization algorithm + * URI. * @param inclusiveNamespacePrefixes The namespace prefixes to be processed - * according to canonical XML. + * according to canonical XML. */ public ExclusiveCanonicalizationImpl( - String algorithmURI, - List inclusiveNamespacePrefixes) { + String algorithmURI, + List inclusiveNamespacePrefixes) { setAlgorithmURI(algorithmURI); setInclusiveNamespacePrefixes(inclusiveNamespacePrefixes); } /** * Sets the namespace prefixes to be processed according to canonical XML. - * + * * @param inclusiveNamespacePrefixes The prefixes of the namespaces to treat - * according to canonical XML. + * according to canonical XML. */ protected void setInclusiveNamespacePrefixes(List inclusiveNamespacePrefixes) { this.inclusiveNamespacePrefixes = inclusiveNamespacePrefixes; @@ -69,29 +69,32 @@ public class ExclusiveCanonicalizationImpl /** * @see iaik.server.modules.xml.ExclusiveCanonicalization#getInclusiveNamespacePrefixes() */ + @Override public List getInclusiveNamespacePrefixes() { return inclusiveNamespacePrefixes; } /** * Compare this object to another CanonicalizationTransform. - * - * @param other The object to compare this - * ExclusiveCanonicalization to. + * + * @param other The object to compare this + * ExclusiveCanonicalization to. * @return true, if other is a - * ExclusiveCanonicalization and the algorithm URIs match, - * otherwise false. + * ExclusiveCanonicalization and the algorithm URIs match, + * otherwise false. * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object other) { if (other instanceof ExclusiveCanonicalization) { - ExclusiveCanonicalization eC14n = - (ExclusiveCanonicalization) other; - boolean algURIEquals = getAlgorithmURI().equals(eC14n.getAlgorithmURI()); - boolean inclNSPrefs = - (getInclusiveNamespacePrefixes() == null || getInclusiveNamespacePrefixes().isEmpty()) - ? eC14n.getInclusiveNamespacePrefixes() == null || eC14n.getInclusiveNamespacePrefixes().isEmpty() - : getInclusiveNamespacePrefixes().equals(eC14n.getInclusiveNamespacePrefixes()); + final ExclusiveCanonicalization eC14n = + (ExclusiveCanonicalization) other; + final boolean algURIEquals = getAlgorithmURI().equals(eC14n.getAlgorithmURI()); + final boolean inclNSPrefs = + getInclusiveNamespacePrefixes() == null || getInclusiveNamespacePrefixes().isEmpty() + ? eC14n.getInclusiveNamespacePrefixes() == null || eC14n.getInclusiveNamespacePrefixes() + .isEmpty() + : getInclusiveNamespacePrefixes().equals(eC14n.getInclusiveNamespacePrefixes()); return algURIEquals && inclNSPrefs; } return false; diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java index 9026d33..9f4e22d 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/SigningTimeImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Date; @@ -30,18 +29,18 @@ import iaik.server.modules.xml.SigningTime; /** * An implementation of the SigningTime Property. - * + * * @author Patrick Peck * @version $Id$ */ public class SigningTimeImpl implements SigningTime { - + /** The signing time. */ - private Date signingTime; - + private final Date signingTime; + /** * Create a new SigningTimeImpl. - * + * * @param signingTime The signing time. */ public SigningTimeImpl(Date signingTime) { @@ -51,6 +50,7 @@ public class SigningTimeImpl implements SigningTime { /** * @see iaik.server.modules.xml.SigningTime#getSigningTime() */ + @Override public Date getSigningTime() { return signingTime; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java index 1595446..fa3401e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/TransformationImpl.java @@ -21,14 +21,13 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import iaik.server.modules.xml.Transformation; /** * Base implementation class for Transformation derived classes. - * + * * @author Patrick Peck * @version $Id$ */ @@ -36,32 +35,34 @@ public abstract class TransformationImpl implements Transformation { /** The algorithm URI identifying the transformation algorithm. */ private String algorithmURI; - + /** * @see iaik.server.modules.xml.Transformation#getAlgorithmURI() */ + @Override public String getAlgorithmURI() { return algorithmURI; } /** * Sets the algorithm URI. - * + * * @param algorithmURI The algorithm URI to set. */ protected void setAlgorithmURI(String algorithmURI) { this.algorithmURI = algorithmURI; } - + /** * Returns the hash code of the algorithm URI. Should be overridden if a * transformation distinguishes itself from others by more than just the * algorithm URI. - * + * * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getAlgorithmURI().hashCode(); } - + } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java index e8444b9..0688d0e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLDataObjectImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.Element; @@ -30,22 +29,21 @@ import iaik.server.modules.xml.XMLDataObject; /** * A DataObject containing a single DOM element. - * + * * @author Patrick Peck * @version $Id$ */ public class XMLDataObjectImpl - extends DataObjectImpl - implements XMLDataObject { - - /** The XML data contained in this XMLDataObject. */ + extends DataObjectImpl + implements XMLDataObject { + + /** The XML data contained in this XMLDataObject. */ private Element element; - + /** * Create a new XMLDataObjectImpl. - * - * @param element The DOM element contained in this - * XMLDataObject. + * + * @param element The DOM element contained in this XMLDataObject. */ public XMLDataObjectImpl(Element element) { setElement(element); @@ -54,13 +52,14 @@ public class XMLDataObjectImpl /** * @see iaik.server.modules.xml.XMLDataObject#getElement() */ + @Override public Element getElement() { return element; } /** * Set the DOM element contained in this XMLDataObject. - * + * * @param element The DOM element to set. */ public void setElement(Element element) { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java index 2fb9df9..51f96f0 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLNodeListDataObjectImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.NodeList; @@ -30,22 +29,22 @@ import iaik.server.modules.xml.XMLNodeListDataObject; /** * A DataObject containing a list of DOM nodes. - * + * * @author Patrick Peck * @version $Id$ */ public class XMLNodeListDataObjectImpl - extends DataObjectImpl - implements XMLNodeListDataObject { + extends DataObjectImpl + implements XMLNodeListDataObject { /** The nodes contained in this XMLNodeListDataObject. */ private NodeList nodeList; /** * Create a new XMLNodeListDataObjectImpl. - * + * * @param nodeList The list of DOM nodes contained in this - * XMLNodeListDataObject. + * XMLNodeListDataObject. */ public XMLNodeListDataObjectImpl(NodeList nodeList) { setNodeList(nodeList); @@ -54,7 +53,7 @@ public class XMLNodeListDataObjectImpl /** * Set the list of DOM nodes contained in this * XMLNodeListDataObject. - * + * * @param nodeList The list of DOM nodes to set. */ public void setNodeList(NodeList nodeList) { @@ -64,6 +63,7 @@ public class XMLNodeListDataObjectImpl /** * @see iaik.server.modules.xml.XMLNodeListDataObject#getNodeList() */ + @Override public NodeList getNodeList() { return nodeList; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java index 0774726..1844780 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XMLSignatureImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import org.w3c.dom.Element; @@ -29,28 +28,28 @@ import org.w3c.dom.Element; import iaik.server.modules.xml.XMLSignature; /** - * An object containing an XMLDsig signature in the form of a + * An object containing an XMLDsig signature in the form of a * dsig:Signature DOM element. - * + * * @author Patrick Peck * @version $Id$ */ public class XMLSignatureImpl implements XMLSignature { /** The signature DOM element. */ private Element element; - + /** * Create a new XMLSignatureImpl. - * + * * @param element The dsig:Signature DOM element. */ public XMLSignatureImpl(Element element) { setElement(element); } - + /** * Set the dsig:Signature DOM element. - * + * * @param element The dsig:Signature element to set. */ public void setElement(Element element) { @@ -60,6 +59,7 @@ public class XMLSignatureImpl implements XMLSignature { /** * @see iaik.server.modules.xml.XMLSignature#getElement() */ + @Override public Element getElement() { return element; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java index d309302..a44196a 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2FilterImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Map; @@ -31,7 +30,7 @@ import iaik.server.modules.xml.XPath2Transformation.XPath2Filter; /** * An object encapsulating an XPath-Filter2 expression. - * + * * @author Patrick Peck * @version $Id$ */ @@ -46,17 +45,18 @@ public class XPath2FilterImpl implements XPath2Filter { /** * Create a new XPath2FilterImpl object. - * - * @param filterType The type of filter. Must be one of the filter type - * constants declared in iaik.server.modules.xml.XPath2Transformation.XPath2Filter - * @param xPathExpression The XPath expression belonging to this filter. + * + * @param filterType The type of filter. Must be one of the filter + * type constants declared in + * iaik.server.modules.xml.XPath2Transformation.XPath2Filter + * @param xPathExpression The XPath expression belonging to this filter. * @param namespaceDeclarations The namespace declarations visible for this - * XPath2Filter. + * XPath2Filter. */ public XPath2FilterImpl( - String filterType, - String xPathExpression, - Map namespaceDeclarations) { + String filterType, + String xPathExpression, + Map namespaceDeclarations) { setFilterType(filterType); setXPathExpression(xPathExpression); @@ -66,13 +66,14 @@ public class XPath2FilterImpl implements XPath2Filter { /** * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getFilterType() */ + @Override public String getFilterType() { return filterType; } /** * Set the filter type. - * + * * @param filterType The filter type to set. */ protected void setFilterType(String filterType) { @@ -82,13 +83,14 @@ public class XPath2FilterImpl implements XPath2Filter { /** * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getXPathExpression() */ + @Override public String getXPathExpression() { return xPathExpression; } /** * Set the XPath expression. - * + * * @param xPathExpression The XPath expression to set. */ protected void setXPathExpression(String xPathExpression) { @@ -98,15 +100,16 @@ public class XPath2FilterImpl implements XPath2Filter { /** * @see iaik.server.modules.xml.XPath2Transformation.XPath2Filter#getNamespaceDeclarations() */ + @Override public Map getNamespaceDeclarations() { return namespaceDeclarations; } /** * Set the namespace declarations. - * - * @param namespaceDeclarations The mapping between namespace prefixes and - * their associated URI. + * + * @param namespaceDeclarations The mapping between namespace prefixes and their + * associated URI. */ protected void setNamespaceDeclarations(Map namespaceDeclarations) { this.namespaceDeclarations = namespaceDeclarations; @@ -114,18 +117,19 @@ public class XPath2FilterImpl implements XPath2Filter { /** * Compare this object to another. - * + * * @param other The object to compare this XPath2Filter to. * @return true, if other is a - * XPath2Filter and the filter types match and the XPath - * expressions match. Otherwise false is returned. + * XPath2Filter and the filter types match and the XPath + * expressions match. Otherwise false is returned. * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object other) { if (other instanceof XPath2Transformation.XPath2Filter) { - XPath2Filter filter = (XPath2Transformation.XPath2Filter) other; + final XPath2Filter filter = (XPath2Transformation.XPath2Filter) other; return getFilterType().equals(filter.getFilterType()) - && getXPathExpression().equals(filter.getXPathExpression()); + && getXPathExpression().equals(filter.getXPathExpression()); } return false; } @@ -133,6 +137,7 @@ public class XPath2FilterImpl implements XPath2Filter { /** * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getXPathExpression().hashCode() * 31 + getFilterType().hashCode(); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java index f483b18..b49bd64 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.ArrayList; @@ -33,20 +32,20 @@ import iaik.server.modules.xml.XPath2Transformation; /** * An object encapsulating a Transformation containing several * XPath-Filter2 expressions. - * + * * @author Patrick Peck * @version $Id$ */ public class XPath2TransformationImpl - extends TransformationImpl - implements XPath2Transformation { + extends TransformationImpl + implements XPath2Transformation { /** The filters contained in this XPath2Transformation */ - private List xPathFilters = new ArrayList(); + private final List xPathFilters = new ArrayList(); /** * Create a new XPath2TransformationImpl. - * + * * The list of XPath-Filter2 expression is initially empty. */ public XPath2TransformationImpl() { @@ -56,13 +55,14 @@ public class XPath2TransformationImpl /** * @see iaik.server.modules.xml.XPath2Transformation#getXPathFilters() */ + @Override public List getXPathFilters() { return xPathFilters; } /** * Add an XPath-Filter2 expression to the list of filters. - * + * * @param filter The filter to add. */ public void addXPathFilter(XPath2Filter filter) { @@ -71,18 +71,18 @@ public class XPath2TransformationImpl /** * Compare this XPath2Transformation to another. - * - * @param other The object to compare this - * XPath2Transformation to. + * + * @param other The object to compare this XPath2Transformation to. * @return true, if other is an - * XPath2Transformation and getXPathFilters() equals - * other.getXPathFilters(). Otherwise false is - * returned. + * XPath2Transformation and getXPathFilters() + * equals other.getXPathFilters(). Otherwise + * false is returned. * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object other) { if (other instanceof XPath2Transformation) { - XPath2Transformation transform = (XPath2Transformation) other; + final XPath2Transformation transform = (XPath2Transformation) other; return getXPathFilters().equals(transform.getXPathFilters()); } @@ -92,8 +92,9 @@ public class XPath2TransformationImpl /** * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { - Iterator iter = getXPathFilters().iterator(); + final Iterator iter = getXPathFilters().iterator(); int hashCode = 0; while (iter.hasNext()) { diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java index 06cc319..65b33f4 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPathTransformationImpl.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.iaik.xml; import java.util.Map; @@ -30,13 +29,13 @@ import iaik.server.modules.xml.XPathTransformation; /** * A Transformation containing an XPath expression. - * + * * @author Patrick Peck * @version $Id$ */ public class XPathTransformationImpl - extends TransformationImpl - implements XPathTransformation { + extends TransformationImpl + implements XPathTransformation { /** The XPath expression. */ private String xPathExpression; @@ -45,16 +44,16 @@ public class XPathTransformationImpl /** * Create a new XPathTransformationImpl. - * + * * The namespace declarations are initialized empty. - * - * @param xPathExpression The XPath expression this object will contain. + * + * @param xPathExpression The XPath expression this object will contain. * @param namespaceDeclarations The namespace declarations visible for this - * XPath. + * XPath. */ public XPathTransformationImpl( - String xPathExpression, - Map namespaceDeclarations) { + String xPathExpression, + Map namespaceDeclarations) { setAlgorithmURI(XPathTransformation.XPATH); setXPathExpression(xPathExpression); @@ -63,7 +62,7 @@ public class XPathTransformationImpl /** * Set the XPath expression. - * + * * @param xPathExpression The XPath expression. */ protected void setXPathExpression(String xPathExpression) { @@ -73,6 +72,7 @@ public class XPathTransformationImpl /** * @see iaik.server.modules.xml.XPathTransformation#getXPathExpression() */ + @Override public String getXPathExpression() { return xPathExpression; } @@ -80,15 +80,16 @@ public class XPathTransformationImpl /** * @see iaik.server.modules.xml.XPathTransformation#getNamespaceDeclarations() */ + @Override public Map getNamespaceDeclarations() { return namespaceDeclarations; } /** * Set the namespace declarations. - * - * @param namespaceDeclarations The mapping between namespace prefixes and - * their associated URI. + * + * @param namespaceDeclarations The mapping between namespace prefixes and their + * associated URI. */ protected void setNamespaceDeclarations(Map namespaceDeclarations) { this.namespaceDeclarations = namespaceDeclarations; @@ -96,17 +97,18 @@ public class XPathTransformationImpl /** * Compare this XPathTransformation to another. - * - * @param other The object to compare this - * XPathTransformation to. + * + * @param other The object to compare this XPathTransformation to. * @return true, if other is an - * XPathTransformation and if this object contains the same XPath - * expression as other. Otherwise false is returned. + * XPathTransformation and if this object contains the same + * XPath expression as other. Otherwise false + * is returned. * @see java.lang.Object#equals(Object) */ + @Override public boolean equals(Object other) { if (other instanceof XPathTransformation) { - XPathTransformation transform = (XPathTransformation) other; + final XPathTransformation transform = (XPathTransformation) other; return getXPathExpression().equals(transform.getXPathExpression()); } return false; @@ -115,6 +117,7 @@ public class XPathTransformationImpl /** * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getXPathExpression().hashCode(); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java index 9dc45fc..6c71f42 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XSLTTransformationImpl.java @@ -45,204 +45,194 @@ import at.gv.egovernment.moaspss.util.XPathException; import at.gv.egovernment.moaspss.util.XPathUtils; import iaik.server.modules.xml.MOAXSecProvider; import iaik.server.modules.xml.XSLTTransformation; -import iaik.xml.crypto.dsig.XMLSignatureFactory; -import iaik.xml.filter.impl.dsig.CanonInputStream; -import iaik.xml.filter.impl.dsig.Canonicalizer; -import iaik.xml.filter.impl.dsig.Traverser; /** * A Transformation containing an XSLT transformation. - * + * * @author Patrick Peck * @version $Id$ */ public class XSLTTransformationImpl extends TransformationImpl implements XSLTTransformation { - /** The XSLT stylesheet. */ - private Element styleSheetElement; - /** - * The hash code of the canonicalized stylesheet. If calculated, this value - * should be != 0. - */ - private int hashCode; - - /** - * Create a new XSLTTransformationImpl object. - * - * @param styleSheetElement - * The XSLT stylesheet element. - */ - public XSLTTransformationImpl(Element styleSheetElement) { - setAlgorithmURI(XSLTTransformation.XSLT); - setStyleSheetElement(styleSheetElement); - } - - /** - * Set the XSLT stylesheet element. - * - * @param styleSheetElement - * The XSLT stylesheet element to set. - */ - protected void setStyleSheetElement(Element styleSheetElement) { - this.styleSheetElement = styleSheetElement; - this.hashCode = 0; - } - - /** - * @see iaik.server.modules.xml.XSLTTransformation#getStylesheetElement() - */ - public Element getStylesheetElement() { - return styleSheetElement; - } - - /** - * Compare this XSLTTransformation to another. - * - * @param other - * The object to compare this XSLTTransformation to. - * @return true, if other is an - * XSLTTransformation and if the canonicalized - * representations of the stylesheets contained in this - * and other match. Otherwise, false is - * returned. - * @see java.lang.Object#equals(Object) - */ - public boolean equals(Object other) { - if (other instanceof XSLTTransformation) { - XSLTTransformation xslt = (XSLTTransformation) other; - - return compareElements(getStylesheetElement(), xslt.getStylesheetElement()); - } - return false; - } - - /** - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - if (hashCode == 0) { - hashCode = calculateHashCode(getStylesheetElement()); - } - return hashCode; - } - - /** - * Calculate the hash code for a DOM element by canonicalizing it. - * - * @param element - * The DOM element for which the hash code is to be calculated. - * @return int The hash code, or 0, if it could not be - * calculated. - */ - private static int calculateHashCode(Element element) { - try { - InputStream is = canonicalize(element); - byte[] buf = new byte[256]; - int hashCode = 1; - int length; - int i; - - while ((length = is.read(buf)) > 0) { - for (i = 0; i < length; i++) { - hashCode += buf[i] * 31 + i; - } - } - is.close(); - return hashCode; - } catch (IOException e) { - return 0; - } catch (NoSuchAlgorithmException e) { - return 0; - } catch (InvalidAlgorithmParameterException e) { - return 0; - } catch (TransformException e) { - return 0; - } - } - - /** - * Compare two DOM elements by canonicalizing their contents and comparing - * the resulting byte stream. - * - * @param elem1 - * The 1st element to compare. - * @param elem2 - * The 2nd element to compare. - * @return boolean true, if the elements are considered equal - * after canonicalization. Otherwise false is returned. - */ - private static boolean compareElements(Element elem1, Element elem2) { - try { - InputStream is1 = canonicalize(elem1); - InputStream is2 = canonicalize(elem2); - return StreamUtils.compareStreams(is1, is2); - } catch (IOException e) { - return false; - } catch (NoSuchAlgorithmException e) { - return false; - } catch (InvalidAlgorithmParameterException e) { - return false; - } catch (TransformException e) { - return false; - } - } - - /** - * Canonicalize a DOM element. + /** The XSLT stylesheet. */ + private Element styleSheetElement; + /** + * The hash code of the canonicalized stylesheet. If calculated, this value + * should be != 0. + */ + private int hashCode; + + /** + * Create a new XSLTTransformationImpl object. + * + * @param styleSheetElement The XSLT stylesheet element. + */ + public XSLTTransformationImpl(Element styleSheetElement) { + setAlgorithmURI(XSLTTransformation.XSLT); + setStyleSheetElement(styleSheetElement); + } + + /** + * Set the XSLT stylesheet element. + * + * @param styleSheetElement The XSLT stylesheet element to set. + */ + protected void setStyleSheetElement(Element styleSheetElement) { + this.styleSheetElement = styleSheetElement; + this.hashCode = 0; + } + + /** + * @see iaik.server.modules.xml.XSLTTransformation#getStylesheetElement() + */ + @Override + public Element getStylesheetElement() { + return styleSheetElement; + } + + /** + * Compare this XSLTTransformation to another. + * + * @param other The object to compare this XSLTTransformation to. + * @return true, if other is an + * XSLTTransformation and if the canonicalized + * representations of the stylesheets contained in this and + * other match. Otherwise, false is returned. + * @see java.lang.Object#equals(Object) + */ + @Override + public boolean equals(Object other) { + if (other instanceof XSLTTransformation) { + final XSLTTransformation xslt = (XSLTTransformation) other; + + return compareElements(getStylesheetElement(), xslt.getStylesheetElement()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + if (hashCode == 0) { + hashCode = calculateHashCode(getStylesheetElement()); + } + return hashCode; + } + + /** + * Calculate the hash code for a DOM element by canonicalizing it. * + * @param element The DOM element for which the hash code is to be calculated. + * @return int The hash code, or 0, if it could not be calculated. + */ + private static int calculateHashCode(Element element) { + try { + final InputStream is = canonicalize(element); + final byte[] buf = new byte[256]; + int hashCode = 1; + int length; + int i; + + while ((length = is.read(buf)) > 0) { + for (i = 0; i < length; i++) { + hashCode += buf[i] * 31 + i; + } + } + is.close(); + return hashCode; + } catch (final IOException e) { + return 0; + } catch (final NoSuchAlgorithmException e) { + return 0; + } catch (final InvalidAlgorithmParameterException e) { + return 0; + } catch (final TransformException e) { + return 0; + } + } + + /** + * Compare two DOM elements by canonicalizing their contents and comparing the + * resulting byte stream. + * + * @param elem1 The 1st element to compare. + * @param elem2 The 2nd element to compare. + * @return boolean true, if the elements are considered equal after + * canonicalization. Otherwise false is returned. + */ + private static boolean compareElements(Element elem1, Element elem2) { + try { + final InputStream is1 = canonicalize(elem1); + final InputStream is2 = canonicalize(elem2); + return StreamUtils.compareStreams(is1, is2); + } catch (final IOException e) { + return false; + } catch (final NoSuchAlgorithmException e) { + return false; + } catch (final InvalidAlgorithmParameterException e) { + return false; + } catch (final TransformException e) { + return false; + } + } + + /** + * Canonicalize a DOM element. + * * @param element The element to canonicalize. * @return InputStream A stream with the canonicalized data. - * @throws InvalidAlgorithmParameterException - * @throws IOException - * @throws TransformException - * @throws AlgorithmException An error occurred canonicalizing the element. + * @throws InvalidAlgorithmParameterException + * @throws IOException + * @throws TransformException + * @throws AlgorithmException An error occurred canonicalizing + * the element. */ private static InputStream canonicalize(Element element) - throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException, TransformException { - // CanonicalizationMethod canonicalizationMethod = - // MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod( - // CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); - - //CanonicalizationAlgorithm c14n = - // new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); - //Traverser traverser = new Traverser(element, true, true); - //Canonicalizer canonicalizer = new Canonicalizer(traverser, false, true, null); - - //return new CanonInputStream(canonicalizer); - - CanonicalizationMethod canonicalizationMethod = - MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod( - CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); - - //CanonicalizationAlgorithm c14n = - // new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); - NodeList nodeList; - - try { - nodeList = XPathUtils.selectNodeList(element, - XPathUtils.ALL_NODES_XPATH); - } catch (XPathException e) { - nodeList = new NodeListAdapter(Collections.EMPTY_LIST); - } - //c14n.setInput(nodeList); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - canonicalizationMethod.transform(new - NodeListToNodeSetDataAdapter(nodeList), null, baos); - baos.close(); - return new ByteArrayInputStream(baos.toByteArray()); - /* - NodeList nodeList; - + throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException, TransformException { + // CanonicalizationMethod canonicalizationMethod = + // MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod( + // CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); + + // CanonicalizationAlgorithm c14n = + // new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); + // Traverser traverser = new Traverser(element, true, true); + // Canonicalizer canonicalizer = new Canonicalizer(traverser, false, true, + // null); + + // return new CanonInputStream(canonicalizer); + + final CanonicalizationMethod canonicalizationMethod = + MOAXSecProvider.getXMLSignatureFactory().newCanonicalizationMethod( + CanonicalizationMethod.EXCLUSIVE, new ExcC14NParameterSpec()); + + // CanonicalizationAlgorithm c14n = + // new CanonicalizationAlgorithmImplExclusiveCanonicalXML(); + NodeList nodeList; + try { - nodeList = XPathUtils.selectNodeList(element, XPathUtils.ALL_NODES_XPATH); - } catch (XPathException e) { + nodeList = XPathUtils.selectNodeList(element, + XPathUtils.ALL_NODES_XPATH); + } catch (final XPathException e) { nodeList = new NodeListAdapter(Collections.EMPTY_LIST); } - //c14n.setInput(nodeList); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); + // c14n.setInput(nodeList); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); canonicalizationMethod.transform(new NodeListToNodeSetDataAdapter(nodeList), null, baos); baos.close(); - return new ByteArrayInputStream(baos.toByteArray());*/ + return new ByteArrayInputStream(baos.toByteArray()); + /* + * NodeList nodeList; + * + * try { nodeList = XPathUtils.selectNodeList(element, + * XPathUtils.ALL_NODES_XPATH); } catch (XPathException e) { nodeList = new + * NodeListAdapter(Collections.EMPTY_LIST); } //c14n.setInput(nodeList); + * ByteArrayOutputStream baos = new ByteArrayOutputStream(); + * canonicalizationMethod.transform(new NodeListToNodeSetDataAdapter(nodeList), + * null, baos); baos.close(); return new + * ByteArrayInputStream(baos.toByteArray()); + */ } } -- cgit v1.2.3