KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > URIReferenceException


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  */

4 /*
5  * $Id: URIReferenceException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
6  */

7 package javax.xml.crypto;
8
9 import java.io.PrintStream JavaDoc;
10 import java.io.PrintWriter JavaDoc;
11 import javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
12
13 /**
14  * Indicates an exceptional condition thrown while dereferencing a
15  * {@link URIReference}.
16  *
17  * <p>A <code>URIReferenceException</code> can contain a cause: another
18  * throwable that caused this <code>URIReferenceException</code> to get thrown.
19  *
20  * @author Sean Mullan
21  * @author JSR 105 Expert Group
22  * @since 1.6
23  * @see URIDereferencer#dereference(URIReference, XMLCryptoContext)
24  * @see RetrievalMethod#dereference(XMLCryptoContext)
25  */

26 public class URIReferenceException extends Exception JavaDoc {
27
28     private static final long serialVersionUID = 7173469703932561419L;
29
30     /**
31      * The throwable that caused this exception to get thrown, or null if this
32      * exception was not caused by another throwable or if the causative
33      * throwable is unknown.
34      *
35      * @serial
36      */

37     private Throwable JavaDoc cause;
38
39     private URIReference uriReference;
40
41     /**
42      * Constructs a new <code>URIReferenceException</code> with
43      * <code>null</code> as its detail message.
44      */

45     public URIReferenceException() {
46         super();
47     }
48
49     /**
50      * Constructs a new <code>URIReferenceException</code> with the specified
51      * detail message.
52      *
53      * @param message the detail message
54      */

55     public URIReferenceException(String JavaDoc message) {
56         super(message);
57     }
58
59     /**
60      * Constructs a new <code>URIReferenceException</code> with the
61      * specified detail message and cause.
62      * <p>Note that the detail message associated with
63      * <code>cause</code> is <i>not</i> automatically incorporated in
64      * this exception's detail message.
65      *
66      * @param message the detail message
67      * @param cause the cause (A <tt>null</tt> value is permitted, and
68      * indicates that the cause is nonexistent or unknown.)
69      */

70     public URIReferenceException(String JavaDoc message, Throwable JavaDoc cause) {
71         super(message);
72         this.cause = cause;
73     }
74
75     /**
76      * Constructs a new <code>URIReferenceException</code> with the
77      * specified detail message, cause and <code>URIReference</code>.
78      * <p>Note that the detail message associated with
79      * <code>cause</code> is <i>not</i> automatically incorporated in
80      * this exception's detail message.
81      *
82      * @param message the detail message
83      * @param cause the cause (A <tt>null</tt> value is permitted, and
84      * indicates that the cause is nonexistent or unknown.)
85      * @param uriReference the <code>URIReference</code> that was being
86      * dereferenced when the error was encountered
87      * @throws NullPointerException if <code>uriReference</code> is
88      * <code>null</code>
89      */

90     public URIReferenceException(String JavaDoc message, Throwable JavaDoc cause,
91     URIReference uriReference) {
92     this(message, cause);
93     if (uriReference == null) {
94         throw new NullPointerException JavaDoc("uriReference cannot be null");
95     }
96     this.uriReference = uriReference;
97     }
98
99     /**
100      * Constructs a new <code>URIReferenceException</code> with the specified
101      * cause and a detail message of <code>(cause==null ? null :
102      * cause.toString())</code> (which typically contains the class and detail
103      * message of <code>cause</code>).
104      *
105      * @param cause the cause (A <tt>null</tt> value is permitted, and
106      * indicates that the cause is nonexistent or unknown.)
107      */

108     public URIReferenceException(Throwable JavaDoc cause) {
109         super(cause==null ? null : cause.toString());
110         this.cause = cause;
111     }
112
113     /**
114      * Returns the <code>URIReference</code> that was being dereferenced
115      * when the exception was thrown.
116      *
117      * @return the <code>URIReference</code> that was being dereferenced
118      * when the exception was thrown, or <code>null</code> if not specified
119      */

120     public URIReference getURIReference() {
121     return uriReference;
122     }
123
124     /**
125      * Returns the cause of this <code>URIReferenceException</code> or
126      * <code>null</code> if the cause is nonexistent or unknown. (The
127      * cause is the throwable that caused this
128      * <code>URIReferenceException</code> to get thrown.)
129      *
130      * @return the cause of this <code>URIReferenceException</code> or
131      * <code>null</code> if the cause is nonexistent or unknown.
132      */

133     public Throwable JavaDoc getCause() {
134         return cause;
135     }
136
137     /**
138      * Prints this <code>URIReferenceException</code>, its backtrace and
139      * the cause's backtrace to the standard error stream.
140      */

141     public void printStackTrace() {
142     super.printStackTrace();
143     //XXX print backtrace of cause
144
}
145
146     /**
147      * Prints this <code>URIReferenceException</code>, its backtrace and
148      * the cause's backtrace to the specified print stream.
149      *
150      * @param s <code>PrintStream</code> to use for output
151      */

152     public void printStackTrace(PrintStream JavaDoc s) {
153     super.printStackTrace(s);
154     //XXX print backtrace of cause
155
}
156
157     /**
158      * Prints this <code>URIReferenceException</code>, its backtrace and
159      * the cause's backtrace to the specified print writer.
160      *
161      * @param s <code>PrintWriter</code> to use for output
162      */

163     public void printStackTrace(PrintWriter JavaDoc s) {
164         super.printStackTrace(s);
165     //XXX print backtrace of cause
166
}
167 }
168
Popular Tags