01 /*
02 * Copyright 1994-2000 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
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 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.lang;
27
28 /**
29 * The class <code>Exception</code> and its subclasses are a form of
30 * <code>Throwable</code> that indicates conditions that a reasonable
31 * application might want to catch.
32 *
33 * @author Frank Yellin
34 * @version 1.38, 05/05/07
35 * @see java.lang.Error
36 * @since JDK1.0
37 */
38 public class Exception extends Throwable {
39 static final long serialVersionUID = -3387516993124229948L;
40
41 /**
42 * Constructs a new exception with <code>null</code> as its detail message.
43 * The cause is not initialized, and may subsequently be initialized by a
44 * call to {@link #initCause}.
45 */
46 public Exception() {
47 super ();
48 }
49
50 /**
51 * Constructs a new exception with the specified detail message. The
52 * cause is not initialized, and may subsequently be initialized by
53 * a call to {@link #initCause}.
54 *
55 * @param message the detail message. The detail message is saved for
56 * later retrieval by the {@link #getMessage()} method.
57 */
58 public Exception(String message) {
59 super (message);
60 }
61
62 /**
63 * Constructs a new exception with the specified detail message and
64 * cause. <p>Note that the detail message associated with
65 * <code>cause</code> is <i>not</i> automatically incorporated in
66 * this exception's detail message.
67 *
68 * @param message the detail message (which is saved for later retrieval
69 * by the {@link #getMessage()} method).
70 * @param cause the cause (which is saved for later retrieval by the
71 * {@link #getCause()} method). (A <tt>null</tt> value is
72 * permitted, and indicates that the cause is nonexistent or
73 * unknown.)
74 * @since 1.4
75 */
76 public Exception(String message, Throwable cause) {
77 super (message, cause);
78 }
79
80 /**
81 * Constructs a new exception with the specified cause and a detail
82 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
83 * typically contains the class and detail message of <tt>cause</tt>).
84 * This constructor is useful for exceptions that are little more than
85 * wrappers for other throwables (for example, {@link
86 * java.security.PrivilegedActionException}).
87 *
88 * @param cause the cause (which is saved for later retrieval by the
89 * {@link #getCause()} method). (A <tt>null</tt> value is
90 * permitted, and indicates that the cause is nonexistent or
91 * unknown.)
92 * @since 1.4
93 */
94 public Exception(Throwable cause) {
95 super(cause);
96 }
97 }
|