View Javadoc

1   /*
2    *  Copyright 2002-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package net.sf.collections15;
17  
18  import java.util.NoSuchElementException;
19  
20  /***
21   * The BufferUnderflowException is used when the buffer is already empty.
22   * <p>
23   * NOTE: From version 3.0, this exception extends NoSuchElementException.
24   * 
25   * @since Commons Collections 2.1
26   * @version $Revision: 1.1 $ $Date: 2005/03/19 07:13:35 $
27   *
28   * @author Avalon
29   * @author Berin Loritsch
30   * @author Jeff Turner
31   * @author Paul Jack
32   * @author Stephen Colebourne
33   */
34  public class BufferUnderflowException extends NoSuchElementException {
35      
36      /*** The root cause throwable */
37      private final Throwable throwable;
38  
39      /***
40       * Constructs a new <code>BufferUnderflowException</code>.
41       */
42      public BufferUnderflowException() {
43          super();
44          throwable = null;
45      }
46  
47      /*** 
48       * Construct a new <code>BufferUnderflowException</code>.
49       * 
50       * @param message  the detail message for this exception
51       */
52      public BufferUnderflowException(String message) {
53          this(message, null);
54      }
55  
56      /*** 
57       * Construct a new <code>BufferUnderflowException</code>.
58       * 
59       * @param message  the detail message for this exception
60       * @param exception  the root cause of the exception
61       */
62      public BufferUnderflowException(String message, Throwable exception) {
63          super(message);
64          throwable = exception;
65      }
66  
67      /***
68       * Gets the root cause of the exception.
69       *
70       * @return the root cause
71       */
72      public final Throwable getCause() {
73          return throwable;
74      }
75      
76  }