Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/MarshalException.java
41159 views
/*1* Copyright (c) 2005, 2013, 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 of {@code cause}).101*102* @param cause the cause (A {@code null} value is permitted, and103* indicates that the cause is nonexistent or unknown.)104*/105public MarshalException(Throwable cause) {106super(cause==null ? null : cause.toString());107this.cause = cause;108}109110/**111* Returns the cause of this {@code MarshalException} or112* {@code null} if the cause is nonexistent or unknown. (The113* cause is the throwable that caused this114* {@code MarshalException} to get thrown.)115*116* @return the cause of this {@code MarshalException} or117* {@code null} if the cause is nonexistent or unknown.118*/119public Throwable getCause() {120return cause;121}122123/**124* Prints this {@code MarshalException}, its backtrace and125* the cause's backtrace to the standard error stream.126*/127public void printStackTrace() {128super.printStackTrace();129//XXX print backtrace of cause130}131132/**133* Prints this {@code MarshalException}, its backtrace and134* the cause's backtrace to the specified print stream.135*136* @param s {@code PrintStream} to use for output137*/138public void printStackTrace(PrintStream s) {139super.printStackTrace(s);140//XXX print backtrace of cause141}142143/**144* Prints this {@code MarshalException}, its backtrace and145* the cause's backtrace to the specified print writer.146*147* @param s {@code PrintWriter} to use for output148*/149public void printStackTrace(PrintWriter s) {150super.printStackTrace(s);151//XXX print backtrace of cause152}153}154155156