David Jencks | 9c8e4b1 | 2014-11-21 22:13:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) OSGi Alliance (2004, 2014). All Rights Reserved. |
| 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 org.osgi.service.component; |
| 18 | |
| 19 | /** |
| 20 | * Unchecked exception which may be thrown by Service Component Runtime. |
| 21 | * |
| 22 | * @author $Id: 6b47774608ff37a2076b9f58090509093314a67a $ |
| 23 | */ |
| 24 | public class ComponentException extends RuntimeException { |
| 25 | static final long serialVersionUID = -7438212656298726924L; |
| 26 | |
| 27 | /** |
| 28 | * Construct a new ComponentException with the specified message and cause. |
| 29 | * |
| 30 | * @param message The message for the exception. |
| 31 | * @param cause The cause of the exception. May be {@code null}. |
| 32 | */ |
| 33 | public ComponentException(String message, Throwable cause) { |
| 34 | super(message, cause); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Construct a new ComponentException with the specified message. |
| 39 | * |
| 40 | * @param message The message for the exception. |
| 41 | */ |
| 42 | public ComponentException(String message) { |
| 43 | super(message); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Construct a new ComponentException with the specified cause. |
| 48 | * |
| 49 | * @param cause The cause of the exception. May be {@code null}. |
| 50 | */ |
| 51 | public ComponentException(Throwable cause) { |
| 52 | super(cause); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the cause of this exception or {@code null} if no cause was set. |
| 57 | * |
| 58 | * @return The cause of this exception or {@code null} if no cause was set. |
| 59 | */ |
| 60 | @Override |
| 61 | public Throwable getCause() { |
| 62 | return super.getCause(); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Initializes the cause of this exception to the specified value. |
| 67 | * |
| 68 | * @param cause The cause of this exception. |
| 69 | * @return This exception. |
| 70 | * @throws IllegalArgumentException If the specified cause is this |
| 71 | * exception. |
| 72 | * @throws IllegalStateException If the cause of this exception has already |
| 73 | * been set. |
| 74 | */ |
| 75 | @Override |
| 76 | public Throwable initCause(Throwable cause) { |
| 77 | return super.initCause(cause); |
| 78 | } |
| 79 | } |