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 package org.apache.commons.collections;
18
19 /**
20 * The BufferOverflowException is used when the buffer's capacity has been
21 * exceeded.
22 *
23 * @since Commons Collections 2.1
24 * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
25 *
26 * @author Avalon
27 * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
28 * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
29 * @author Paul Jack
30 * @author Stephen Colebourne
31 */
32 public class BufferOverflowException extends RuntimeException {
33
34 /** The root cause throwable */
35 private final Throwable throwable;
36
37 /**
38 * Constructs a new <code>BufferOverflowException</code>.
39 */
40 public BufferOverflowException() {
41 super();
42 throwable = null;
43 }
44
45 /**
46 * Construct a new <code>BufferOverflowException</code>.
47 *
48 * @param message the detail message for this exception
49 */
50 public BufferOverflowException(String message) {
51 this(message, null);
52 }
53
54 /**
55 * Construct a new <code>BufferOverflowException</code>.
56 *
57 * @param message the detail message for this exception
58 * @param exception the root cause of the exception
59 */
60 public BufferOverflowException(String message, Throwable exception) {
61 super(message);
62 throwable = exception;
63 }
64
65 /**
66 * Gets the root cause of the exception.
67 *
68 * @return the root cause
69 */
70 public final Throwable getCause() {
71 return throwable;
72 }
73
74 }