Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/KeySelectorException.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: KeySelectorException.java,v 1.3 2005/05/10 15:47:42 mullan Exp $26*/27package javax.xml.crypto;2829import java.io.PrintStream;30import java.io.PrintWriter;3132/**33* Indicates an exceptional condition thrown by a {@link KeySelector}.34*35* <p>A {@code KeySelectorException} can contain a cause: another36* throwable that caused this {@code KeySelectorException} to get thrown.37*38* @author Sean Mullan39* @author JSR 105 Expert Group40* @since 1.641*/42public class KeySelectorException extends Exception {4344private static final long serialVersionUID = -7480033639322531109L;4546/**47* The throwable that caused this exception to get thrown, or48* {@code null} if this exception was not caused by another throwable49* or if the causative throwable is unknown.50*51* @serial52*/53private Throwable cause;5455/**56* Constructs a new {@code KeySelectorException} with57* {@code null} as its detail message.58*/59public KeySelectorException() {60super();61}6263/**64* Constructs a new {@code KeySelectorException} with the specified65* detail message.66*67* @param message the detail message68*/69public KeySelectorException(String message) {70super(message);71}7273/**74* Constructs a new {@code KeySelectorException} with the75* specified detail message and cause.76* <p>Note that the detail message associated with77* {@code cause} is <i>not</i> automatically incorporated in78* this exception's detail message.79*80* @param message the detail message81* @param cause the cause (A {@code null} value is permitted, and82* indicates that the cause is nonexistent or unknown.)83*/84public KeySelectorException(String message, Throwable cause) {85super(message);86this.cause = cause;87}8889/**90* Constructs a new {@code KeySelectorException} with the specified91* cause and a detail message of92* {@code (cause==null ? null : cause.toString())}93* (which typically contains the class and detail message of94* {@code cause}).95*96* @param cause the cause (A {@code null} value is permitted, and97* indicates that the cause is nonexistent or unknown.)98*/99public KeySelectorException(Throwable cause) {100super(cause==null ? null : cause.toString());101this.cause = cause;102}103104/**105* Returns the cause of this {@code KeySelectorException} or106* {@code null} if the cause is nonexistent or unknown. (The107* cause is the throwable that caused this108* {@code KeySelectorException} to get thrown.)109*110* @return the cause of this {@code KeySelectorException} or111* {@code null} if the cause is nonexistent or unknown.112*/113public Throwable getCause() {114return cause;115}116117/**118* Prints this {@code KeySelectorException}, its backtrace and119* the cause's backtrace to the standard error stream.120*/121public void printStackTrace() {122super.printStackTrace();123//XXX print backtrace of cause124}125126/**127* Prints this {@code KeySelectorException}, its backtrace and128* the cause's backtrace to the specified print stream.129*130* @param s {@code PrintStream} to use for output131*/132public void printStackTrace(PrintStream s) {133super.printStackTrace(s);134//XXX print backtrace of cause135}136137/**138* Prints this {@code KeySelectorException}, its backtrace and139* the cause's backtrace to the specified print writer.140*141* @param s {@code PrintWriter} to use for output142*/143public void printStackTrace(PrintWriter s) {144super.printStackTrace(s);145//XXX print backtrace of cause146}147}148149150