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 package org.apache.commons.collections; 018 019 /** 020 * The BufferOverflowException is used when the buffer's capacity has been 021 * exceeded. 022 * 023 * @since Commons Collections 2.1 024 * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ 025 * 026 * @author Avalon 027 * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a> 028 * @author <a href="mailto:jefft@apache.org">Jeff Turner</a> 029 * @author Paul Jack 030 * @author Stephen Colebourne 031 */ 032 public class BufferOverflowException extends RuntimeException { 033 034 /** The root cause throwable */ 035 private final Throwable throwable; 036 037 /** 038 * Constructs a new <code>BufferOverflowException</code>. 039 */ 040 public BufferOverflowException() { 041 super(); 042 throwable = null; 043 } 044 045 /** 046 * Construct a new <code>BufferOverflowException</code>. 047 * 048 * @param message the detail message for this exception 049 */ 050 public BufferOverflowException(String message) { 051 this(message, null); 052 } 053 054 /** 055 * Construct a new <code>BufferOverflowException</code>. 056 * 057 * @param message the detail message for this exception 058 * @param exception the root cause of the exception 059 */ 060 public BufferOverflowException(String message, Throwable exception) { 061 super(message); 062 throwable = exception; 063 } 064 065 /** 066 * Gets the root cause of the exception. 067 * 068 * @return the root cause 069 */ 070 public final Throwable getCause() { 071 return throwable; 072 } 073 074 }