Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/xml/crypto/MarshalException.java
38918 views
/*1* Copyright (c) 2005, 2019, 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: MarshalException.java,v 1.5 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* Indicates an exceptional condition that occurred during the XML39* marshalling or unmarshalling process.40*41* <p>A {@code MarshalException} can contain a cause: another42* throwable that caused this {@code MarshalException} to get thrown.43*44* @author Sean Mullan45* @author JSR 105 Expert Group46* @since 1.647* @see XMLSignature#sign(XMLSignContext)48* @see XMLSignatureFactory#unmarshalXMLSignature(XMLValidateContext)49*/50public class MarshalException extends Exception {5152private static final long serialVersionUID = -863185580332643547L;5354/**55* The throwable that caused this exception to get thrown, or null if this56* exception was not caused by another throwable or if the causative57* throwable is unknown.58*59* @serial60*/61private Throwable cause;6263/**64* Constructs a new {@code MarshalException} with65* {@code null} as its detail message.66*/67public MarshalException() {68super();69}7071/**72* Constructs a new {@code MarshalException} with the specified73* detail message.74*75* @param message the detail message76*/77public MarshalException(String message) {78super(message);79}8081/**82* Constructs a new {@code MarshalException} with the83* specified detail message and cause.84* <p>Note that the detail message associated with85* {@code cause} is <i>not</i> automatically incorporated in86* this exception's detail message.87*88* @param message the detail message89* @param cause the cause (A {@code null} value is permitted, and90* indicates that the cause is nonexistent or unknown.)91*/92public MarshalException(String message, Throwable cause) {93super(message);94this.cause = cause;95}9697/**98* Constructs a new {@code MarshalException} with the specified cause99* and a detail message of {@code (cause==null ? null : cause.toString())100* } (which typically contains the class and detail message of101* {@code cause}).102*103* @param cause the cause (A {@code null} value is permitted, and104* indicates that the cause is nonexistent or unknown.)105*/106public MarshalException(Throwable cause) {107super(cause==null ? null : cause.toString());108this.cause = cause;109}110111/**112* Returns the cause of this {@code MarshalException} or113* {@code null} if the cause is nonexistent or unknown. (The114* cause is the throwable that caused this115* {@code MarshalException} to get thrown.)116*117* @return the cause of this {@code MarshalException} or118* {@code null} if the cause is nonexistent or unknown.119*/120public Throwable getCause() {121return cause;122}123124/**125* Prints this {@code MarshalException}, its backtrace and126* the cause's backtrace to the standard error stream.127*/128public void printStackTrace() {129super.printStackTrace();130//XXX print backtrace of cause131}132133/**134* Prints this {@code MarshalException}, its backtrace and135* the cause's backtrace to the specified print stream.136*137* @param s {@code PrintStream} to use for output138*/139public void printStackTrace(PrintStream s) {140super.printStackTrace(s);141//XXX print backtrace of cause142}143144/**145* Prints this {@code MarshalException}, its backtrace and146* the cause's backtrace to the specified print writer.147*148* @param s {@code PrintWriter} to use for output149*/150public void printStackTrace(PrintWriter s) {151super.printStackTrace(s);152//XXX print backtrace of cause153}154}155156157