001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.catalina;
019:
020: /**
021: * General purpose exception that is thrown to indicate a lifecycle related
022: * problem. Such exceptions should generally be considered fatal to the
023: * operation of the application containing this component.
024: *
025: * @author Craig R. McClanahan
026: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
027: */
028:
029: public final class LifecycleException extends Exception {
030:
031: //------------------------------------------------------------ Constructors
032:
033: /**
034: * Construct a new LifecycleException with no other information.
035: */
036: public LifecycleException() {
037:
038: this (null, null);
039:
040: }
041:
042: /**
043: * Construct a new LifecycleException for the specified message.
044: *
045: * @param message Message describing this exception
046: */
047: public LifecycleException(String message) {
048:
049: this (message, null);
050:
051: }
052:
053: /**
054: * Construct a new LifecycleException for the specified throwable.
055: *
056: * @param throwable Throwable that caused this exception
057: */
058: public LifecycleException(Throwable throwable) {
059:
060: this (null, throwable);
061:
062: }
063:
064: /**
065: * Construct a new LifecycleException for the specified message
066: * and throwable.
067: *
068: * @param message Message describing this exception
069: * @param throwable Throwable that caused this exception
070: */
071: public LifecycleException(String message, Throwable throwable) {
072:
073: super ();
074: this .message = message;
075: this .throwable = throwable;
076:
077: }
078:
079: //------------------------------------------------------ Instance Variables
080:
081: /**
082: * The error message passed to our constructor (if any)
083: */
084: protected String message = null;
085:
086: /**
087: * The underlying exception or error passed to our constructor (if any)
088: */
089: protected Throwable throwable = null;
090:
091: //---------------------------------------------------------- Public Methods
092:
093: /**
094: * Returns the message associated with this exception, if any.
095: */
096: public String getMessage() {
097:
098: return (message);
099:
100: }
101:
102: /**
103: * Returns the throwable that caused this exception, if any.
104: */
105: public Throwable getThrowable() {
106:
107: return (throwable);
108:
109: }
110:
111: /**
112: * Return a formatted string that describes this exception.
113: */
114: public String toString() {
115:
116: StringBuffer sb = new StringBuffer("LifecycleException: ");
117: if (message != null) {
118: sb.append(message);
119: if (throwable != null) {
120: sb.append(": ");
121: }
122: }
123: if (throwable != null) {
124: sb.append(throwable.toString());
125: }
126: return (sb.toString());
127:
128: }
129:
130: }
|