Example usage for javax.xml.crypto NoSuchMechanismException NoSuchMechanismException

List of usage examples for javax.xml.crypto NoSuchMechanismException NoSuchMechanismException

Introduction

In this page you can find the example usage for javax.xml.crypto NoSuchMechanismException NoSuchMechanismException.

Prototype

public NoSuchMechanismException(Throwable cause) 

Source Link

Document

Constructs a new NoSuchMechanismException with the specified cause and a detail message of (cause==null ?

Usage

From source file:Main.java

/**
 * @throws NoSuchMechanismException/* w w w .ja va 2s  .  c om*/
 */
static XMLSignatureFactory getDOMInstance() {

    try {
        return XMLSignatureFactory.getInstance("DOM");
    } catch (NoSuchMechanismException nsme) {
        Provider provider;

        try {
            Class<?> clazz = Class.forName("org.jcp.xml.dsig.internal.dom.XMLDSigRI");

            provider = (Provider) clazz.newInstance();
        } catch (Exception e) {
            throw new NoSuchMechanismException(e);
        }

        return XMLSignatureFactory.getInstance("DOM", provider);
    }
}