001 /*
002 * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.osgi.service.component;
018
019 /**
020 * Unchecked exception which may be thrown by the Service Component Runtime.
021 *
022 * @version $Revision: 6083 $
023 */
024 public class ComponentException extends RuntimeException {
025 static final long serialVersionUID = -7438212656298726924L;
026
027 /**
028 * Construct a new ComponentException with the specified message and cause.
029 *
030 * @param message The message for the exception.
031 * @param cause The cause of the exception. May be <code>null</code>.
032 */
033 public ComponentException(String message, Throwable cause) {
034 super(message, cause);
035 }
036
037 /**
038 * Construct a new ComponentException with the specified message.
039 *
040 * @param message The message for the exception.
041 */
042 public ComponentException(String message) {
043 super(message);
044 }
045
046 /**
047 * Construct a new ComponentException with the specified cause.
048 *
049 * @param cause The cause of the exception. May be <code>null</code>.
050 */
051 public ComponentException(Throwable cause) {
052 super(cause);
053 }
054
055 /**
056 * Returns the cause of this exception or <code>null</code> if no cause was
057 * set.
058 *
059 * @return The cause of this exception or <code>null</code> if no cause was
060 * set.
061 */
062 public Throwable getCause() {
063 return super.getCause();
064 }
065
066 /**
067 * Initializes the cause of this exception to the specified value.
068 *
069 * @param cause The cause of this exception.
070 * @return This exception.
071 * @throws IllegalArgumentException If the specified cause is this
072 * exception.
073 * @throws IllegalStateException If the cause of this exception has already
074 * been set.
075 */
076 public Throwable initCause(Throwable cause) {
077 return super.initCause(cause);
078 }
079 }