KickJava   Java API By Example, From Geeks To Geeks.

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


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

4 /*
5  * $Id: NoSuchMechanismException.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.Manifest;
12 import javax.xml.crypto.dsig.XMLSignature;
13 import javax.xml.crypto.dsig.XMLSignatureFactory;
14 import javax.xml.crypto.dsig.keyinfo.KeyInfo;
15 import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
16
17 /**
18  * This exception is thrown when a particular XML mechanism is requested but
19  * is not available in the environment.
20  *
21  * <p>A <code>NoSuchMechanismException</code> can contain a cause: another
22  * throwable that caused this <code>NoSuchMechanismException</code> to get
23  * thrown.
24  *
25  * @author Sean Mullan
26  * @author JSR 105 Expert Group
27  * @since 1.6
28  * @see XMLSignatureFactory#getInstance XMLSignatureFactory.getInstance
29  * @see KeyInfoFactory#getInstance KeyInfoFactory.getInstance
30  */

31 public class NoSuchMechanismException extends RuntimeException JavaDoc {
32
33     private static final long serialVersionUID = 4189669069570660166L;
34
35     /**
36      * The throwable that caused this exception to get thrown, or null if this
37      * exception was not caused by another throwable or if the causative
38      * throwable is unknown.
39      *
40      * @serial
41      */

42     private Throwable JavaDoc cause;
43
44     /**
45      * Constructs a new <code>NoSuchMechanismException</code> with
46      * <code>null</code> as its detail message.
47      */

48     public NoSuchMechanismException() {
49         super();
50     }
51
52     /**
53      * Constructs a new <code>NoSuchMechanismException</code> with the
54      * specified detail message.
55      *
56      * @param message the detail message
57      */

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

73     public NoSuchMechanismException(String JavaDoc message, Throwable JavaDoc cause) {
74         super(message);
75         this.cause = cause;
76     }
77
78     /**
79      * Constructs a new <code>NoSuchMechanismException</code> with the
80      * specified cause and a detail message of
81      * <code>(cause==null ? null : cause.toString())</code> (which typically
82      * contains the class and detail message of <code>cause</code>).
83      *
84      * @param cause the cause (A <tt>null</tt> value is permitted, and
85      * indicates that the cause is nonexistent or unknown.)
86      */

87     public NoSuchMechanismException(Throwable JavaDoc cause) {
88         super(cause==null ? null : cause.toString());
89         this.cause = cause;
90     }
91
92     /**
93      * Returns the cause of this <code>NoSuchMechanismException</code> or
94      * <code>null</code> if the cause is nonexistent or unknown. (The
95      * cause is the throwable that caused this
96      * <code>NoSuchMechanismException</code> to get thrown.)
97      *
98      * @return the cause of this <code>NoSuchMechanismException</code> or
99      * <code>null</code> if the cause is nonexistent or unknown.
100      */

101     public Throwable JavaDoc getCause() {
102         return cause;
103     }
104
105     /**
106      * Prints this <code>NoSuchMechanismException</code>, its backtrace and
107      * the cause's backtrace to the standard error stream.
108      */

109     public void printStackTrace() {
110     super.printStackTrace();
111     //XXX print backtrace of cause
112
}
113
114     /**
115      * Prints this <code>NoSuchMechanismException</code>, its backtrace and
116      * the cause's backtrace to the specified print stream.
117      *
118      * @param s <code>PrintStream</code> to use for output
119      */

120     public void printStackTrace(PrintStream JavaDoc s) {
121     super.printStackTrace(s);
122     //XXX print backtrace of cause
123
}
124
125     /**
126      * Prints this <code>NoSuchMechanismException</code>, its backtrace and
127      * the cause's backtrace to the specified print writer.
128      *
129      * @param s <code>PrintWriter</code> to use for output
130      */

131     public void printStackTrace(PrintWriter JavaDoc s) {
132         super.printStackTrace(s);
133     //XXX print backtrace of cause
134
}
135 }
136
Popular Tags