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 org.apache.commons.collections;
  17. import java.util.NoSuchElementException;
  18. /**
  19. * The BufferUnderflowException is used when the buffer is already empty.
  20. * <p>
  21. * NOTE: From version 3.0, this exception extends NoSuchElementException.
  22. *
  23. * @since Commons Collections 2.1
  24. * @version $Revision: 1.1 $ $Date: 2004/05/10 19:50:52 $
  25. *
  26. * @author Avalon
  27. * @author Berin Loritsch
  28. * @author Jeff Turner
  29. * @author Paul Jack
  30. * @author Stephen Colebourne
  31. */
  32. public class BufferUnderflowException extends NoSuchElementException {
  33. /** The root cause throwable */
  34. private final Throwable throwable;
  35. /**
  36. * Constructs a new <code>BufferUnderflowException</code>.
  37. */
  38. public BufferUnderflowException() {
  39. super();
  40. throwable = null;
  41. }
  42. /**
  43. * Construct a new <code>BufferUnderflowException</code>.
  44. *
  45. * @param message the detail message for this exception
  46. */
  47. public BufferUnderflowException(String message) {
  48. this(message, null);
  49. }
  50. /**
  51. * Construct a new <code>BufferUnderflowException</code>.
  52. *
  53. * @param message the detail message for this exception
  54. * @param exception the root cause of the exception
  55. */
  56. public BufferUnderflowException(String message, Throwable exception) {
  57. super(message);
  58. throwable = exception;
  59. }
  60. /**
  61. * Gets the root cause of the exception.
  62. *
  63. * @return the root cause
  64. */
  65. public final Throwable getCause() {
  66. return throwable;
  67. }
  68. }