0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A/*
0N/A * $Id: URIReferenceException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
0N/A */
0N/Apackage javax.xml.crypto;
0N/A
0N/Aimport java.io.PrintStream;
0N/Aimport java.io.PrintWriter;
0N/Aimport javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
0N/A
0N/A/**
0N/A * Indicates an exceptional condition thrown while dereferencing a
0N/A * {@link URIReference}.
0N/A *
0N/A * <p>A <code>URIReferenceException</code> can contain a cause: another
0N/A * throwable that caused this <code>URIReferenceException</code> to get thrown.
0N/A *
0N/A * @author Sean Mullan
0N/A * @author JSR 105 Expert Group
0N/A * @since 1.6
0N/A * @see URIDereferencer#dereference(URIReference, XMLCryptoContext)
0N/A * @see RetrievalMethod#dereference(XMLCryptoContext)
0N/A */
0N/Apublic class URIReferenceException extends Exception {
0N/A
0N/A private static final long serialVersionUID = 7173469703932561419L;
0N/A
0N/A /**
0N/A * The throwable that caused this exception to get thrown, or null if this
0N/A * exception was not caused by another throwable or if the causative
0N/A * throwable is unknown.
0N/A *
0N/A * @serial
0N/A */
0N/A private Throwable cause;
0N/A
0N/A private URIReference uriReference;
0N/A
0N/A /**
0N/A * Constructs a new <code>URIReferenceException</code> with
0N/A * <code>null</code> as its detail message.
0N/A */
0N/A public URIReferenceException() {
0N/A super();
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new <code>URIReferenceException</code> with the specified
0N/A * detail message.
0N/A *
0N/A * @param message the detail message
0N/A */
0N/A public URIReferenceException(String message) {
0N/A super(message);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new <code>URIReferenceException</code> with the
0N/A * specified detail message and cause.
0N/A * <p>Note that the detail message associated with
0N/A * <code>cause</code> is <i>not</i> automatically incorporated in
0N/A * this exception's detail message.
0N/A *
0N/A * @param message the detail message
0N/A * @param cause the cause (A <tt>null</tt> value is permitted, and
0N/A * indicates that the cause is nonexistent or unknown.)
0N/A */
0N/A public URIReferenceException(String message, Throwable cause) {
0N/A super(message);
0N/A this.cause = cause;
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new <code>URIReferenceException</code> with the
0N/A * specified detail message, cause and <code>URIReference</code>.
0N/A * <p>Note that the detail message associated with
0N/A * <code>cause</code> is <i>not</i> automatically incorporated in
0N/A * this exception's detail message.
0N/A *
0N/A * @param message the detail message
0N/A * @param cause the cause (A <tt>null</tt> value is permitted, and
0N/A * indicates that the cause is nonexistent or unknown.)
0N/A * @param uriReference the <code>URIReference</code> that was being
0N/A * dereferenced when the error was encountered
0N/A * @throws NullPointerException if <code>uriReference</code> is
0N/A * <code>null</code>
0N/A */
0N/A public URIReferenceException(String message, Throwable cause,
0N/A URIReference uriReference) {
0N/A this(message, cause);
0N/A if (uriReference == null) {
0N/A throw new NullPointerException("uriReference cannot be null");
0N/A }
0N/A this.uriReference = uriReference;
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new <code>URIReferenceException</code> with the specified
0N/A * cause and a detail message of <code>(cause==null ? null :
0N/A * cause.toString())</code> (which typically contains the class and detail
0N/A * message of <code>cause</code>).
0N/A *
0N/A * @param cause the cause (A <tt>null</tt> value is permitted, and
0N/A * indicates that the cause is nonexistent or unknown.)
0N/A */
0N/A public URIReferenceException(Throwable cause) {
0N/A super(cause==null ? null : cause.toString());
0N/A this.cause = cause;
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>URIReference</code> that was being dereferenced
0N/A * when the exception was thrown.
0N/A *
0N/A * @return the <code>URIReference</code> that was being dereferenced
0N/A * when the exception was thrown, or <code>null</code> if not specified
0N/A */
0N/A public URIReference getURIReference() {
0N/A return uriReference;
0N/A }
0N/A
0N/A /**
0N/A * Returns the cause of this <code>URIReferenceException</code> or
0N/A * <code>null</code> if the cause is nonexistent or unknown. (The
0N/A * cause is the throwable that caused this
0N/A * <code>URIReferenceException</code> to get thrown.)
0N/A *
0N/A * @return the cause of this <code>URIReferenceException</code> or
0N/A * <code>null</code> if the cause is nonexistent or unknown.
0N/A */
0N/A public Throwable getCause() {
0N/A return cause;
0N/A }
0N/A
0N/A /**
0N/A * Prints this <code>URIReferenceException</code>, its backtrace and
0N/A * the cause's backtrace to the standard error stream.
0N/A */
0N/A public void printStackTrace() {
0N/A super.printStackTrace();
0N/A //XXX print backtrace of cause
0N/A }
0N/A
0N/A /**
0N/A * Prints this <code>URIReferenceException</code>, its backtrace and
0N/A * the cause's backtrace to the specified print stream.
0N/A *
0N/A * @param s <code>PrintStream</code> to use for output
0N/A */
0N/A public void printStackTrace(PrintStream s) {
0N/A super.printStackTrace(s);
0N/A //XXX print backtrace of cause
0N/A }
0N/A
0N/A /**
0N/A * Prints this <code>URIReferenceException</code>, its backtrace and
0N/A * the cause's backtrace to the specified print writer.
0N/A *
0N/A * @param s <code>PrintWriter</code> to use for output
0N/A */
0N/A public void printStackTrace(PrintWriter s) {
0N/A super.printStackTrace(s);
0N/A //XXX print backtrace of cause
0N/A }
0N/A}