    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    import java.util.NoSuchElementException;
    020
    021    /**
    022     * The BufferUnderflowException is used when the buffer is already empty.
    023     * <p>
    024     * NOTE: From version 3.0, this exception extends NoSuchElementException.
    025     *
    026     * @since Commons Collections 2.1
    027     * @version $Revision: 555824 $ $Date: 2007-07-13 01:27:15 +0100 (Fri, 13 Jul 2007) $
    028     *
    029     * @author Avalon
    030     * @author Berin Loritsch
    031     * @author Jeff Turner
    032     * @author Paul Jack
    033     * @author Stephen Colebourne
    034     */
    035    public class BufferUnderflowException extends NoSuchElementException {
    036
    037        /** The root cause throwable */
    038        private final Throwable throwable;
    039
    040        /**
    041         * Constructs a new <code>BufferUnderflowException</code>.
    042         */
    043        public BufferUnderflowException() {
    044            super();
    045            throwable = null;
    046        }
    047
    048        /**
    049         * Construct a new <code>BufferUnderflowException</code>.
    050         *
    051         * @param message  the detail message for this exception
    052         */
    053        public BufferUnderflowException(String message) {
    054            this(message, null);
    055        }
    056
    057        /**
    058         * Construct a new <code>BufferUnderflowException</code>.
    059         *
    060         * @param message  the detail message for this exception
    061         * @param exception  the root cause of the exception
    062         */
    063        public BufferUnderflowException(String message, Throwable exception) {
    064            super(message);
    065            throwable = exception;
    066        }
    067
    068        /**
    069         * Gets the root cause of the exception.
    070         *
    071         * @return the root cause
    072         */
    073        public final Throwable getCause() {
    074            return throwable;
    075        }
    076
    077    }