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