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