author | duke |
Wed, 05 Jul 2017 20:52:05 +0200 | |
changeset 32881 | 5f9d335c43c3 |
parent 32275 | 17eeb583a331 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
/* |
|
26 |
* $Id: NoSuchMechanismException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $ |
|
27 |
*/ |
|
28 |
package javax.xml.crypto; |
|
29 |
||
30 |
import java.io.PrintStream; |
|
31 |
import java.io.PrintWriter; |
|
32 |
import javax.xml.crypto.dsig.Manifest; |
|
33 |
import javax.xml.crypto.dsig.XMLSignature; |
|
34 |
import javax.xml.crypto.dsig.XMLSignatureFactory; |
|
35 |
import javax.xml.crypto.dsig.keyinfo.KeyInfo; |
|
36 |
import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory; |
|
37 |
||
38 |
/** |
|
39 |
* This exception is thrown when a particular XML mechanism is requested but |
|
40 |
* is not available in the environment. |
|
41 |
* |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
42 |
* <p>A {@code NoSuchMechanismException} can contain a cause: another |
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
43 |
* throwable that caused this {@code NoSuchMechanismException} to get |
2 | 44 |
* thrown. |
45 |
* |
|
46 |
* @author Sean Mullan |
|
47 |
* @author JSR 105 Expert Group |
|
48 |
* @since 1.6 |
|
49 |
* @see XMLSignatureFactory#getInstance XMLSignatureFactory.getInstance |
|
50 |
* @see KeyInfoFactory#getInstance KeyInfoFactory.getInstance |
|
51 |
*/ |
|
52 |
public class NoSuchMechanismException extends RuntimeException { |
|
53 |
||
54 |
private static final long serialVersionUID = 4189669069570660166L; |
|
55 |
||
56 |
/** |
|
57 |
* The throwable that caused this exception to get thrown, or null if this |
|
58 |
* exception was not caused by another throwable or if the causative |
|
59 |
* throwable is unknown. |
|
60 |
* |
|
61 |
* @serial |
|
62 |
*/ |
|
63 |
private Throwable cause; |
|
64 |
||
65 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
66 |
* Constructs a new {@code NoSuchMechanismException} with |
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
67 |
* {@code null} as its detail message. |
2 | 68 |
*/ |
69 |
public NoSuchMechanismException() { |
|
70 |
super(); |
|
71 |
} |
|
72 |
||
73 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
74 |
* Constructs a new {@code NoSuchMechanismException} with the |
2 | 75 |
* specified detail message. |
76 |
* |
|
77 |
* @param message the detail message |
|
78 |
*/ |
|
79 |
public NoSuchMechanismException(String message) { |
|
80 |
super(message); |
|
81 |
} |
|
82 |
||
83 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
84 |
* Constructs a new {@code NoSuchMechanismException} with the |
2 | 85 |
* specified detail message and cause. |
86 |
* <p>Note that the detail message associated with |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
87 |
* {@code cause} is <i>not</i> automatically incorporated in |
2 | 88 |
* this exception's detail message. |
89 |
* |
|
90 |
* @param message the detail message |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
91 |
* @param cause the cause (A {@code null} value is permitted, and |
2 | 92 |
* indicates that the cause is nonexistent or unknown.) |
93 |
*/ |
|
94 |
public NoSuchMechanismException(String message, Throwable cause) { |
|
95 |
super(message); |
|
96 |
this.cause = cause; |
|
97 |
} |
|
98 |
||
99 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
100 |
* Constructs a new {@code NoSuchMechanismException} with the |
2 | 101 |
* specified cause and a detail message of |
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
102 |
* {@code (cause==null ? null : cause.toString())} (which typically |
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
103 |
* contains the class and detail message of {@code cause}). |
2 | 104 |
* |
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
105 |
* @param cause the cause (A {@code null} value is permitted, and |
2 | 106 |
* indicates that the cause is nonexistent or unknown.) |
107 |
*/ |
|
108 |
public NoSuchMechanismException(Throwable cause) { |
|
109 |
super(cause==null ? null : cause.toString()); |
|
110 |
this.cause = cause; |
|
111 |
} |
|
112 |
||
113 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
114 |
* Returns the cause of this {@code NoSuchMechanismException} or |
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
115 |
* {@code null} if the cause is nonexistent or unknown. (The |
2 | 116 |
* cause is the throwable that caused this |
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
117 |
* {@code NoSuchMechanismException} to get thrown.) |
2 | 118 |
* |
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
119 |
* @return the cause of this {@code NoSuchMechanismException} or |
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
120 |
* {@code null} if the cause is nonexistent or unknown. |
2 | 121 |
*/ |
122 |
public Throwable getCause() { |
|
123 |
return cause; |
|
124 |
} |
|
125 |
||
126 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
127 |
* Prints this {@code NoSuchMechanismException}, its backtrace and |
2 | 128 |
* the cause's backtrace to the standard error stream. |
129 |
*/ |
|
130 |
public void printStackTrace() { |
|
131 |
super.printStackTrace(); |
|
132 |
//XXX print backtrace of cause |
|
133 |
} |
|
134 |
||
135 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
136 |
* Prints this {@code NoSuchMechanismException}, its backtrace and |
2 | 137 |
* the cause's backtrace to the specified print stream. |
138 |
* |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
139 |
* @param s {@code PrintStream} to use for output |
2 | 140 |
*/ |
141 |
public void printStackTrace(PrintStream s) { |
|
142 |
super.printStackTrace(s); |
|
143 |
//XXX print backtrace of cause |
|
144 |
} |
|
145 |
||
146 |
/** |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
147 |
* Prints this {@code NoSuchMechanismException}, its backtrace and |
2 | 148 |
* the cause's backtrace to the specified print writer. |
149 |
* |
|
32275
17eeb583a331
8133802: replace some <tt> tags (obsolete in html5) in security-libs docs
avstepan
parents:
25859
diff
changeset
|
150 |
* @param s {@code PrintWriter} to use for output |
2 | 151 |
*/ |
152 |
public void printStackTrace(PrintWriter s) { |
|
153 |
super.printStackTrace(s); |
|
154 |
//XXX print backtrace of cause |
|
155 |
} |
|
156 |
} |