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.connector;
019:
020: import java.io.IOException;
021:
022: /**
023: * Wrap an IOException identifying it as being caused by an abort
024: * of a request by a remote client.
025: *
026: * @author Glenn L. Nielsen
027: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
028: */
029:
030: public final class ClientAbortException extends IOException {
031:
032: //------------------------------------------------------------ Constructors
033:
034: /**
035: * Construct a new ClientAbortException with no other information.
036: */
037: public ClientAbortException() {
038:
039: this (null, null);
040:
041: }
042:
043: /**
044: * Construct a new ClientAbortException for the specified message.
045: *
046: * @param message Message describing this exception
047: */
048: public ClientAbortException(String message) {
049:
050: this (message, null);
051:
052: }
053:
054: /**
055: * Construct a new ClientAbortException for the specified throwable.
056: *
057: * @param throwable Throwable that caused this exception
058: */
059: public ClientAbortException(Throwable throwable) {
060:
061: this (null, throwable);
062:
063: }
064:
065: /**
066: * Construct a new ClientAbortException for the specified message
067: * and throwable.
068: *
069: * @param message Message describing this exception
070: * @param throwable Throwable that caused this exception
071: */
072: public ClientAbortException(String message, Throwable throwable) {
073:
074: super ();
075: this .message = message;
076: this .throwable = throwable;
077:
078: }
079:
080: //------------------------------------------------------ Instance Variables
081:
082: /**
083: * The error message passed to our constructor (if any)
084: */
085: protected String message = null;
086:
087: /**
088: * The underlying exception or error passed to our constructor (if any)
089: */
090: protected Throwable throwable = null;
091:
092: //---------------------------------------------------------- Public Methods
093:
094: /**
095: * Returns the message associated with this exception, if any.
096: */
097: public String getMessage() {
098:
099: return (message);
100:
101: }
102:
103: /**
104: * Returns the cause that caused this exception, if any.
105: */
106: public Throwable getCause() {
107:
108: return (throwable);
109:
110: }
111:
112: /**
113: * Return a formatted string that describes this exception.
114: */
115: public String toString() {
116:
117: StringBuffer sb = new StringBuffer("ClientAbortException: ");
118: if (message != null) {
119: sb.append(message);
120: if (throwable != null) {
121: sb.append(": ");
122: }
123: }
124: if (throwable != null) {
125: sb.append(throwable.toString());
126: }
127: return (sb.toString());
128:
129: }
130:
131: }
|