Search in sources :

Example 1 with InvalidTransformException

use of com.sun.org.apache.xml.internal.security.transforms.InvalidTransformException in project jdk8u_jdk by JetBrains.

the class Reference method getHTMLRepresentation.

/**
     * Method getHTMLRepresentation
     * @return The HTML of the transformation
     * @throws XMLSignatureException
     */
public String getHTMLRepresentation() throws XMLSignatureException {
    try {
        XMLSignatureInput nodes = this.getNodesetBeforeFirstCanonicalization();
        Transforms transforms = this.getTransforms();
        Transform c14nTransform = null;
        if (transforms != null) {
            doTransforms: for (int i = 0; i < transforms.getLength(); i++) {
                Transform t = transforms.item(i);
                String uri = t.getURI();
                if (uri.equals(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS) || uri.equals(Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS)) {
                    c14nTransform = t;
                    break doTransforms;
                }
            }
        }
        Set<String> inclusiveNamespaces = new HashSet<String>();
        if (c14nTransform != null && (c14nTransform.length(InclusiveNamespaces.ExclusiveCanonicalizationNamespace, InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1)) {
            // there is one InclusiveNamespaces element
            InclusiveNamespaces in = new InclusiveNamespaces(XMLUtils.selectNode(c14nTransform.getElement().getFirstChild(), InclusiveNamespaces.ExclusiveCanonicalizationNamespace, InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES, 0), this.getBaseURI());
            inclusiveNamespaces = InclusiveNamespaces.prefixStr2Set(in.getInclusiveNamespaces());
        }
        return nodes.getHTMLRepresentation(inclusiveNamespaces);
    } catch (TransformationException ex) {
        throw new XMLSignatureException("empty", ex);
    } catch (InvalidTransformException ex) {
        throw new XMLSignatureException("empty", ex);
    } catch (XMLSecurityException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
Also used : InvalidTransformException(com.sun.org.apache.xml.internal.security.transforms.InvalidTransformException) TransformationException(com.sun.org.apache.xml.internal.security.transforms.TransformationException) Transforms(com.sun.org.apache.xml.internal.security.transforms.Transforms) InclusiveNamespaces(com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces) Transform(com.sun.org.apache.xml.internal.security.transforms.Transform) XMLSecurityException(com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException) HashSet(java.util.HashSet)

Aggregations

XMLSecurityException (com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException)1 InvalidTransformException (com.sun.org.apache.xml.internal.security.transforms.InvalidTransformException)1 Transform (com.sun.org.apache.xml.internal.security.transforms.Transform)1 TransformationException (com.sun.org.apache.xml.internal.security.transforms.TransformationException)1 Transforms (com.sun.org.apache.xml.internal.security.transforms.Transforms)1 InclusiveNamespaces (com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces)1 HashSet (java.util.HashSet)1