Source code: com/simscomputing/SoftwareFaultException.java
1 // Copyright 2000 Sims Computing
2 //
3 // This software is licensed under the GNU Lesser General Public License,
4 // available at http://www.gnu.org/copyleft/lesser.html.
5
6 package com.simscomputing;
7
8 /**
9 Indicates that an error has been detected in the software's design
10 or implementation.
11
12 @deprecated use java.lang.IllegalStateException or com.simscomputing.IllegalStateException instead
13 @author David Sims
14 @version $Revision: 1.1.1.1 $ $Date: 2000/02/21 21:22:32 $
15 @invariant true
16 */
17 public class SoftwareFaultException extends RuntimeException {
18 private Throwable exception;
19
20 // note: there is no default constructor because these kinds of
21 // exceptions are important enough to require an error message
22 // as shown in the following constructors.
23
24 /**
25 Indicates that a software bug was found. The reason for the bug is listed
26 in the specified error message.
27
28 @param String the error message
29 @precondition message != null
30 */
31 public SoftwareFaultException(String message) {
32 super(message);
33
34 if (message == null) {
35 throw new NullPointerException("message is null");
36 } // if
37 } // constructor
38
39 /**
40 Use this constructor to include an exception that was the cause of
41 the software fault.
42
43 @param String the error message
44 @param Throwable the exception that triggered the bug
45 @precondition message != null && exception != null
46 */
47 public SoftwareFaultException(String message, Throwable exception) {
48 super(message);
49
50 if (message == null) {
51 throw new NullPointerException("message is null");
52 } // if
53
54 if (exception == null) {
55 throw new NullPointerException("exception is null");
56 } // if
57
58 this.exception = exception;
59 } // constructor
60
61 // fixme: probably want to override methods from Throwable: look at ImpossibleExceptionException
62 public Throwable getException() {
63 return exception;
64 } // getException()
65 } // SoftwareFaultException