blob: e5c06b2b6a171bad027af66aea0e37bef7f60add [file] [log] [blame]
Christian van Spaandonk569a4c52008-08-02 09:56:01 +00001/*
2 * $Header: /cvshome/build/info.dmtree/src/info/dmtree/DmtIllegalStateException.java,v 1.4 2006/07/13 13:42:12 tszeredi Exp $
3 *
4 * Copyright (c) OSGi Alliance (2006). All Rights Reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package info.dmtree;
20
21/**
22 * Unchecked illegal state exception. This class is used in DMT because
23 * java.lang.IllegalStateException does not exist in CLDC.
24 */
25public class DmtIllegalStateException extends RuntimeException {
26 private static final long serialVersionUID = 2015244852018469700L;
27
28 /**
29 * Nested exception.
30 */
31 private final Throwable cause;
32
33 /**
34 * Create an instance of the exception with no message.
35 */
36 public DmtIllegalStateException() {
37 super();
38 cause = null;
39 }
40
41 /**
42 * Create an instance of the exception with the specified message.
43 *
44 * @param message the reason for the exception
45 */
46 public DmtIllegalStateException(String message) {
47 super(message);
48 cause = null;
49 }
50
51 /**
52 * Create an instance of the exception with the specified cause exception
53 * and no message.
54 *
55 * @param cause the cause of the exception
56 */
57 public DmtIllegalStateException(Throwable cause) {
58 super();
59 this.cause = cause;
60 }
61
62 /**
63 * Create an instance of the exception with the specified message and cause
64 * exception.
65 *
66 * @param message the reason for the exception
67 * @param cause the cause of the exception
68 */
69 public DmtIllegalStateException(String message, Throwable cause) {
70 super(message);
71 this.cause = cause;
72 }
73
74 /**
75 * Returns the cause of this exception or <code>null</code> if no cause
76 * was specified when this exception was created.
77 *
78 * @return the cause of this exception or <code>null</code> if no cause
79 * was specified
80 */
81 public Throwable getCause() {
82 return cause;
83 }
84}