jaroslav@70
|
1 |
/*
|
jaroslav@70
|
2 |
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
|
jaroslav@70
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
jaroslav@70
|
4 |
*
|
jaroslav@70
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
jaroslav@70
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
jaroslav@70
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
jaroslav@70
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
jaroslav@70
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
jaroslav@70
|
10 |
*
|
jaroslav@70
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
jaroslav@70
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
jaroslav@70
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
jaroslav@70
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
jaroslav@70
|
15 |
* accompanied this code).
|
jaroslav@70
|
16 |
*
|
jaroslav@70
|
17 |
* You should have received a copy of the GNU General Public License version
|
jaroslav@70
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
jaroslav@70
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
jaroslav@70
|
20 |
*
|
jaroslav@70
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
jaroslav@70
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
jaroslav@70
|
23 |
* questions.
|
jaroslav@70
|
24 |
*/
|
jaroslav@70
|
25 |
|
jaroslav@70
|
26 |
package java.lang;
|
jaroslav@70
|
27 |
|
jaroslav@70
|
28 |
/**
|
jaroslav@70
|
29 |
* An {@code Error} is a subclass of {@code Throwable}
|
jaroslav@70
|
30 |
* that indicates serious problems that a reasonable application
|
jaroslav@70
|
31 |
* should not try to catch. Most such errors are abnormal conditions.
|
jaroslav@70
|
32 |
* The {@code ThreadDeath} error, though a "normal" condition,
|
jaroslav@70
|
33 |
* is also a subclass of {@code Error} because most applications
|
jaroslav@70
|
34 |
* should not try to catch it.
|
jaroslav@70
|
35 |
* <p>
|
jaroslav@70
|
36 |
* A method is not required to declare in its {@code throws}
|
jaroslav@70
|
37 |
* clause any subclasses of {@code Error} that might be thrown
|
jaroslav@70
|
38 |
* during the execution of the method but not caught, since these
|
jaroslav@70
|
39 |
* errors are abnormal conditions that should never occur.
|
jaroslav@70
|
40 |
*
|
jaroslav@70
|
41 |
* That is, {@code Error} and its subclasses are regarded as unchecked
|
jaroslav@70
|
42 |
* exceptions for the purposes of compile-time checking of exceptions.
|
jaroslav@70
|
43 |
*
|
jaroslav@70
|
44 |
* @author Frank Yellin
|
jaroslav@70
|
45 |
* @see java.lang.ThreadDeath
|
jaroslav@70
|
46 |
* @jls 11.2 Compile-Time Checking of Exceptions
|
jaroslav@70
|
47 |
* @since JDK1.0
|
jaroslav@70
|
48 |
*/
|
jaroslav@70
|
49 |
public class Error extends Throwable {
|
jaroslav@70
|
50 |
static final long serialVersionUID = 4980196508277280342L;
|
jaroslav@70
|
51 |
|
jaroslav@70
|
52 |
/**
|
jaroslav@70
|
53 |
* Constructs a new error with {@code null} as its detail message.
|
jaroslav@70
|
54 |
* The cause is not initialized, and may subsequently be initialized by a
|
jaroslav@70
|
55 |
* call to {@link #initCause}.
|
jaroslav@70
|
56 |
*/
|
jaroslav@70
|
57 |
public Error() {
|
jaroslav@70
|
58 |
super();
|
jaroslav@70
|
59 |
}
|
jaroslav@70
|
60 |
|
jaroslav@70
|
61 |
/**
|
jaroslav@70
|
62 |
* Constructs a new error with the specified detail message. The
|
jaroslav@70
|
63 |
* cause is not initialized, and may subsequently be initialized by
|
jaroslav@70
|
64 |
* a call to {@link #initCause}.
|
jaroslav@70
|
65 |
*
|
jaroslav@70
|
66 |
* @param message the detail message. The detail message is saved for
|
jaroslav@70
|
67 |
* later retrieval by the {@link #getMessage()} method.
|
jaroslav@70
|
68 |
*/
|
jaroslav@70
|
69 |
public Error(String message) {
|
jaroslav@70
|
70 |
super(message);
|
jaroslav@70
|
71 |
}
|
jaroslav@70
|
72 |
|
jaroslav@70
|
73 |
/**
|
jaroslav@70
|
74 |
* Constructs a new error with the specified detail message and
|
jaroslav@70
|
75 |
* cause. <p>Note that the detail message associated with
|
jaroslav@70
|
76 |
* {@code cause} is <i>not</i> automatically incorporated in
|
jaroslav@70
|
77 |
* this error's detail message.
|
jaroslav@70
|
78 |
*
|
jaroslav@70
|
79 |
* @param message the detail message (which is saved for later retrieval
|
jaroslav@70
|
80 |
* by the {@link #getMessage()} method).
|
jaroslav@70
|
81 |
* @param cause the cause (which is saved for later retrieval by the
|
jaroslav@70
|
82 |
* {@link #getCause()} method). (A {@code null} value is
|
jaroslav@70
|
83 |
* permitted, and indicates that the cause is nonexistent or
|
jaroslav@70
|
84 |
* unknown.)
|
jaroslav@70
|
85 |
* @since 1.4
|
jaroslav@70
|
86 |
*/
|
jaroslav@70
|
87 |
public Error(String message, Throwable cause) {
|
jaroslav@70
|
88 |
super(message, cause);
|
jaroslav@70
|
89 |
}
|
jaroslav@70
|
90 |
|
jaroslav@70
|
91 |
/**
|
jaroslav@70
|
92 |
* Constructs a new error with the specified cause and a detail
|
jaroslav@70
|
93 |
* message of {@code (cause==null ? null : cause.toString())} (which
|
jaroslav@70
|
94 |
* typically contains the class and detail message of {@code cause}).
|
jaroslav@70
|
95 |
* This constructor is useful for errors that are little more than
|
jaroslav@70
|
96 |
* wrappers for other throwables.
|
jaroslav@70
|
97 |
*
|
jaroslav@70
|
98 |
* @param cause the cause (which is saved for later retrieval by the
|
jaroslav@70
|
99 |
* {@link #getCause()} method). (A {@code null} value is
|
jaroslav@70
|
100 |
* permitted, and indicates that the cause is nonexistent or
|
jaroslav@70
|
101 |
* unknown.)
|
jaroslav@70
|
102 |
* @since 1.4
|
jaroslav@70
|
103 |
*/
|
jaroslav@70
|
104 |
public Error(Throwable cause) {
|
jaroslav@70
|
105 |
super(cause);
|
jaroslav@70
|
106 |
}
|
jaroslav@70
|
107 |
|
jaroslav@70
|
108 |
/**
|
jaroslav@70
|
109 |
* Constructs a new error with the specified detail message,
|
jaroslav@70
|
110 |
* cause, suppression enabled or disabled, and writable stack
|
jaroslav@70
|
111 |
* trace enabled or disabled.
|
jaroslav@70
|
112 |
*
|
jaroslav@70
|
113 |
* @param message the detail message.
|
jaroslav@70
|
114 |
* @param cause the cause. (A {@code null} value is permitted,
|
jaroslav@70
|
115 |
* and indicates that the cause is nonexistent or unknown.)
|
jaroslav@70
|
116 |
* @param enableSuppression whether or not suppression is enabled
|
jaroslav@70
|
117 |
* or disabled
|
jaroslav@70
|
118 |
* @param writableStackTrace whether or not the stack trace should
|
jaroslav@70
|
119 |
* be writable
|
jaroslav@70
|
120 |
*
|
jaroslav@70
|
121 |
* @since 1.7
|
jaroslav@70
|
122 |
*/
|
jaroslav@70
|
123 |
protected Error(String message, Throwable cause,
|
jaroslav@70
|
124 |
boolean enableSuppression,
|
jaroslav@70
|
125 |
boolean writableStackTrace) {
|
jaroslav@70
|
126 |
super(message, cause, enableSuppression, writableStackTrace);
|
jaroslav@70
|
127 |
}
|
jaroslav@70
|
128 |
}
|