Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/NoSuchMechanismException.java
41159 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24/*25* $Id: NoSuchMechanismException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $26*/27package javax.xml.crypto;2829import java.io.PrintStream;30import java.io.PrintWriter;31import javax.xml.crypto.dsig.Manifest;32import javax.xml.crypto.dsig.XMLSignature;33import javax.xml.crypto.dsig.XMLSignatureFactory;34import javax.xml.crypto.dsig.keyinfo.KeyInfo;35import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;3637/**38* This exception is thrown when a particular XML mechanism is requested but39* is not available in the environment.40*41* <p>A {@code NoSuchMechanismException} can contain a cause: another42* throwable that caused this {@code NoSuchMechanismException} to get43* thrown.44*45* @author Sean Mullan46* @author JSR 105 Expert Group47* @since 1.648* @see XMLSignatureFactory#getInstance XMLSignatureFactory.getInstance49* @see KeyInfoFactory#getInstance KeyInfoFactory.getInstance50*/51public class NoSuchMechanismException extends RuntimeException {5253private static final long serialVersionUID = 4189669069570660166L;5455/**56* The throwable that caused this exception to get thrown, or null if this57* exception was not caused by another throwable or if the causative58* throwable is unknown.59*60* @serial61*/62private Throwable cause;6364/**65* Constructs a new {@code NoSuchMechanismException} with66* {@code null} as its detail message.67*/68public NoSuchMechanismException() {69super();70}7172/**73* Constructs a new {@code NoSuchMechanismException} with the74* specified detail message.75*76* @param message the detail message77*/78public NoSuchMechanismException(String message) {79super(message);80}8182/**83* Constructs a new {@code NoSuchMechanismException} with the84* specified detail message and cause.85* <p>Note that the detail message associated with86* {@code cause} is <i>not</i> automatically incorporated in87* this exception's detail message.88*89* @param message the detail message90* @param cause the cause (A {@code null} value is permitted, and91* indicates that the cause is nonexistent or unknown.)92*/93public NoSuchMechanismException(String message, Throwable cause) {94super(message);95this.cause = cause;96}9798/**99* Constructs a new {@code NoSuchMechanismException} with the100* specified cause and a detail message of101* {@code (cause==null ? null : cause.toString())} (which typically102* contains the class and detail message of {@code cause}).103*104* @param cause the cause (A {@code null} value is permitted, and105* indicates that the cause is nonexistent or unknown.)106*/107public NoSuchMechanismException(Throwable cause) {108super(cause==null ? null : cause.toString());109this.cause = cause;110}111112/**113* Returns the cause of this {@code NoSuchMechanismException} or114* {@code null} if the cause is nonexistent or unknown. (The115* cause is the throwable that caused this116* {@code NoSuchMechanismException} to get thrown.)117*118* @return the cause of this {@code NoSuchMechanismException} or119* {@code null} if the cause is nonexistent or unknown.120*/121public Throwable getCause() {122return cause;123}124125/**126* Prints this {@code NoSuchMechanismException}, its backtrace and127* the cause's backtrace to the standard error stream.128*/129public void printStackTrace() {130super.printStackTrace();131//XXX print backtrace of cause132}133134/**135* Prints this {@code NoSuchMechanismException}, its backtrace and136* the cause's backtrace to the specified print stream.137*138* @param s {@code PrintStream} to use for output139*/140public void printStackTrace(PrintStream s) {141super.printStackTrace(s);142//XXX print backtrace of cause143}144145/**146* Prints this {@code NoSuchMechanismException}, its backtrace and147* the cause's backtrace to the specified print writer.148*149* @param s {@code PrintWriter} to use for output150*/151public void printStackTrace(PrintWriter s) {152super.printStackTrace(s);153//XXX print backtrace of cause154}155}156157158