1. /*
  2. * @(#)Exception.java 1.31 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.lang;
  8. /**
  9. * The class <code>Exception</code> and its subclasses are a form of
  10. * <code>Throwable</code> that indicates conditions that a reasonable
  11. * application might want to catch.
  12. *
  13. * @author Frank Yellin
  14. * @version 1.31, 12/19/03
  15. * @see java.lang.Error
  16. * @since JDK1.0
  17. */
  18. public class Exception extends Throwable {
  19. static final long serialVersionUID = -3387516993124229948L;
  20. /**
  21. * Constructs a new exception with <code>null</code> as its detail message.
  22. * The cause is not initialized, and may subsequently be initialized by a
  23. * call to {@link #initCause}.
  24. */
  25. public Exception() {
  26. super();
  27. }
  28. /**
  29. * Constructs a new exception with the specified detail message. The
  30. * cause is not initialized, and may subsequently be initialized by
  31. * a call to {@link #initCause}.
  32. *
  33. * @param message the detail message. The detail message is saved for
  34. * later retrieval by the {@link #getMessage()} method.
  35. */
  36. public Exception(String message) {
  37. super(message);
  38. }
  39. /**
  40. * Constructs a new exception with the specified detail message and
  41. * cause. <p>Note that the detail message associated with
  42. * <code>cause</code> is <i>not</i> automatically incorporated in
  43. * this exception's detail message.
  44. *
  45. * @param message the detail message (which is saved for later retrieval
  46. * by the {@link #getMessage()} method).
  47. * @param cause the cause (which is saved for later retrieval by the
  48. * {@link #getCause()} method). (A <tt>null</tt> value is
  49. * permitted, and indicates that the cause is nonexistent or
  50. * unknown.)
  51. * @since 1.4
  52. */
  53. public Exception(String message, Throwable cause) {
  54. super(message, cause);
  55. }
  56. /**
  57. * Constructs a new exception with the specified cause and a detail
  58. * message of <tt>(cause==null ? null : cause.toString())</tt> (which
  59. * typically contains the class and detail message of <tt>cause</tt>).
  60. * This constructor is useful for exceptions that are little more than
  61. * wrappers for other throwables (for example, {@link
  62. * java.security.PrivilegedActionException}).
  63. *
  64. * @param cause the cause (which is saved for later retrieval by the
  65. * {@link #getCause()} method). (A <tt>null</tt> value is
  66. * permitted, and indicates that the cause is nonexistent or
  67. * unknown.)
  68. * @since 1.4
  69. */
  70. public Exception(Throwable cause) {
  71. super(cause);
  72. }
  73. }