1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
19 package org.apache.catalina.connector;
20
21 import java.io.IOException;
22
23 /**
24 * Wrap an IOException identifying it as being caused by an abort
25 * of a request by a remote client.
26 *
27 * @author Glenn L. Nielsen
28 * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
29 */
30
31 public final class ClientAbortException extends IOException {
32
33
34 //------------------------------------------------------------ Constructors
35
36
37 /**
38 * Construct a new ClientAbortException with no other information.
39 */
40 public ClientAbortException() {
41
42 this(null, null);
43
44 }
45
46
47 /**
48 * Construct a new ClientAbortException for the specified message.
49 *
50 * @param message Message describing this exception
51 */
52 public ClientAbortException(String message) {
53
54 this(message, null);
55
56 }
57
58
59 /**
60 * Construct a new ClientAbortException for the specified throwable.
61 *
62 * @param throwable Throwable that caused this exception
63 */
64 public ClientAbortException(Throwable throwable) {
65
66 this(null, throwable);
67
68 }
69
70
71 /**
72 * Construct a new ClientAbortException for the specified message
73 * and throwable.
74 *
75 * @param message Message describing this exception
76 * @param throwable Throwable that caused this exception
77 */
78 public ClientAbortException(String message, Throwable throwable) {
79
80 super();
81 this.message = message;
82 this.throwable = throwable;
83
84 }
85
86
87 //------------------------------------------------------ Instance Variables
88
89
90 /**
91 * The error message passed to our constructor (if any)
92 */
93 protected String message = null;
94
95
96 /**
97 * The underlying exception or error passed to our constructor (if any)
98 */
99 protected Throwable throwable = null;
100
101
102 //---------------------------------------------------------- Public Methods
103
104
105 /**
106 * Returns the message associated with this exception, if any.
107 */
108 public String getMessage() {
109
110 return (message);
111
112 }
113
114
115 /**
116 * Returns the cause that caused this exception, if any.
117 */
118 public Throwable getCause() {
119
120 return (throwable);
121
122 }
123
124
125 /**
126 * Return a formatted string that describes this exception.
127 */
128 public String toString() {
129
130 StringBuffer sb = new StringBuffer("ClientAbortException: ");
131 if (message != null) {
132 sb.append(message);
133 if (throwable != null) {
134 sb.append(": ");
135 }
136 }
137 if (throwable != null) {
138 sb.append(throwable.toString());
139 }
140 return (sb.toString());
141
142 }
143
144
145 }