1 |
/* Exception.java -- generic exception thrown to indicate an exceptional |
/* Exception.java -- generic exception thrown to indicate an exceptional |
2 |
condition has occurred. |
condition has occurred. |
3 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
6 |
|
|
8 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
10 |
any later version. |
any later version. |
11 |
|
|
12 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
13 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
39 |
|
|
40 |
package java.lang; |
package java.lang; |
41 |
|
|
|
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
|
|
* "The Java Language Specification", ISBN 0-201-63451-1 |
|
|
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
42 |
/** |
/** |
43 |
* Exceptions may be thrown by one part of a Java program and caught |
* The root class of all exceptions worth catching in a program. This |
44 |
* by another in order to deal with the cause of the exception, such as |
* includes the special category of <code>RuntimeException</code>, which |
45 |
|
* does not need to be declared in a throws clause. Exceptions can be used |
46 |
|
* to represent almost any exceptional behavior, such as programming errors, |
47 |
* mouse movements, keyboard clicking, etc. |
* mouse movements, keyboard clicking, etc. |
48 |
* |
* |
|
* @since JDK 1.0 |
|
|
* |
|
49 |
* @author Brian Jones |
* @author Brian Jones |
50 |
* @author Warren Levy <warrenl@cygnus.com> |
* @author Warren Levy <warrenl@cygnus.com> |
51 |
* @date September 18, 1998. |
* @author Eric Blake <ebb9@email.byu.edu> |
52 |
|
* @status updated to 1.4 |
53 |
*/ |
*/ |
54 |
public class Exception extends Throwable |
public class Exception extends Throwable |
55 |
{ |
{ |
56 |
static final long serialVersionUID = -3387516993124229948L; |
/** |
57 |
|
* Compatible with JDK 1.0+. |
58 |
|
*/ |
59 |
|
private static final long serialVersionUID = -3387516993124229948L; |
60 |
|
|
61 |
/** |
/** |
62 |
* Create an exception without a message. |
* Create an exception without a message. The cause remains uninitialized. |
63 |
|
* |
64 |
|
* @see #initCause(Throwable) |
65 |
*/ |
*/ |
66 |
public Exception() |
public Exception() |
67 |
{ |
{ |
68 |
super(); |
} |
|
} |
|
69 |
|
|
70 |
/** |
/** |
71 |
* Create an exception with a message. |
* Create an exception with a message. The cause remains uninitialized. |
72 |
|
* |
73 |
|
* @param s the message |
74 |
|
* @see #initCause(Throwable) |
75 |
*/ |
*/ |
76 |
public Exception(String s) |
public Exception(String s) |
77 |
{ |
{ |
78 |
super(s); |
super(s); |
79 |
} |
} |
80 |
|
|
81 |
|
/** |
82 |
|
* Create an exception with a message and a cause. |
83 |
|
* |
84 |
|
* @param s the message string |
85 |
|
* @param cause the cause of this error |
86 |
|
* @since 1.4 |
87 |
|
*/ |
88 |
|
public Exception(String s, Throwable cause) |
89 |
|
{ |
90 |
|
super(s, cause); |
91 |
|
} |
92 |
|
|
93 |
|
/** |
94 |
|
* Create an exception with a given cause, and a message of |
95 |
|
* <code>cause == null ? null : cause.toString()</code>. |
96 |
|
* |
97 |
|
* @param cause the cause of this exception |
98 |
|
* @since 1.4 |
99 |
|
*/ |
100 |
|
public Exception(Throwable cause) |
101 |
|
{ |
102 |
|
super(cause); |
103 |
|
} |
104 |
} |
} |