Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/xml/crypto/URIReferenceException.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: URIReferenceException.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.keyinfo.RetrievalMethod;3233/**34* Indicates an exceptional condition thrown while dereferencing a35* {@link URIReference}.36*37* <p>A {@code URIReferenceException} can contain a cause: another38* throwable that caused this {@code URIReferenceException} to get thrown.39*40* @author Sean Mullan41* @author JSR 105 Expert Group42* @since 1.643* @see URIDereferencer#dereference(URIReference, XMLCryptoContext)44* @see RetrievalMethod#dereference(XMLCryptoContext)45*/46public class URIReferenceException extends Exception {4748private static final long serialVersionUID = 7173469703932561419L;4950/**51* The throwable that caused this exception to get thrown, or null if this52* exception was not caused by another throwable or if the causative53* throwable is unknown.54*55* @serial56*/57private Throwable cause;5859private URIReference uriReference;6061/**62* Constructs a new {@code URIReferenceException} with63* {@code null} as its detail message.64*/65public URIReferenceException() {66super();67}6869/**70* Constructs a new {@code URIReferenceException} with the specified71* detail message.72*73* @param message the detail message74*/75public URIReferenceException(String message) {76super(message);77}7879/**80* Constructs a new {@code URIReferenceException} with the81* specified detail message and cause.82* <p>Note that the detail message associated with83* {@code cause} is <i>not</i> automatically incorporated in84* this exception's detail message.85*86* @param message the detail message87* @param cause the cause (A {@code null} value is permitted, and88* indicates that the cause is nonexistent or unknown.)89*/90public URIReferenceException(String message, Throwable cause) {91super(message);92this.cause = cause;93}9495/**96* Constructs a new {@code URIReferenceException} with the97* specified detail message, cause and {@code URIReference}.98* <p>Note that the detail message associated with99* {@code cause} is <i>not</i> automatically incorporated in100* this exception's detail message.101*102* @param message the detail message103* @param cause the cause (A {@code null} value is permitted, and104* indicates that the cause is nonexistent or unknown.)105* @param uriReference the {@code URIReference} that was being106* dereferenced when the error was encountered107* @throws NullPointerException if {@code uriReference} is108* {@code null}109*/110public URIReferenceException(String message, Throwable cause,111URIReference uriReference) {112this(message, cause);113if (uriReference == null) {114throw new NullPointerException("uriReference cannot be null");115}116this.uriReference = uriReference;117}118119/**120* Constructs a new {@code URIReferenceException} with the specified121* cause and a detail message of {@code (cause==null ? null :122* cause.toString())} (which typically contains the class and detail123* message of {@code cause}).124*125* @param cause the cause (A {@code null} value is permitted, and126* indicates that the cause is nonexistent or unknown.)127*/128public URIReferenceException(Throwable cause) {129super(cause==null ? null : cause.toString());130this.cause = cause;131}132133/**134* Returns the {@code URIReference} that was being dereferenced135* when the exception was thrown.136*137* @return the {@code URIReference} that was being dereferenced138* when the exception was thrown, or {@code null} if not specified139*/140public URIReference getURIReference() {141return uriReference;142}143144/**145* Returns the cause of this {@code URIReferenceException} or146* {@code null} if the cause is nonexistent or unknown. (The147* cause is the throwable that caused this148* {@code URIReferenceException} to get thrown.)149*150* @return the cause of this {@code URIReferenceException} or151* {@code null} if the cause is nonexistent or unknown.152*/153public Throwable getCause() {154return cause;155}156157/**158* Prints this {@code URIReferenceException}, its backtrace and159* the cause's backtrace to the standard error stream.160*/161public void printStackTrace() {162super.printStackTrace();163//XXX print backtrace of cause164}165166/**167* Prints this {@code URIReferenceException}, its backtrace and168* the cause's backtrace to the specified print stream.169*170* @param s {@code PrintStream} to use for output171*/172public void printStackTrace(PrintStream s) {173super.printStackTrace(s);174//XXX print backtrace of cause175}176177/**178* Prints this {@code URIReferenceException}, its backtrace and179* the cause's backtrace to the specified print writer.180*181* @param s {@code PrintWriter} to use for output182*/183public void printStackTrace(PrintWriter s) {184super.printStackTrace(s);185//XXX print backtrace of cause186}187}188189190