Source Home >> Java Source 1.6.0 >> java.lang.Error V 0.09
  • 01/*
  • 02 * @(#)Error.java 1.17 05/11/17
  • 03 *
  • 04 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  • 05 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  • 06 */
  • 07
  • 08package java.lang;
  • 09
  • 10/**
  • 11 * An <code>Error</code> is a subclass of <code>Throwable</code>
  • 12 * that indicates serious problems that a reasonable application
  • 13 * should not try to catch. Most such errors are abnormal conditions.
  • 14 * The <code>ThreadDeath</code> error, though a "normal" condition,
  • 15 * is also a subclass of <code>Error</code> because most applications
  • 16 * should not try to catch it.
  • 17 * <p>
  • 18 * A method is not required to declare in its <code>throws</code>
  • 19 * clause any subclasses of <code>Error</code> that might be thrown
  • 20 * during the execution of the method but not caught, since these
  • 21 * errors are abnormal conditions that should never occur.
  • 22 *
  • 23 * @author Frank Yellin
  • 24 * @version 1.17, 11/17/05
  • 25 * @see java.lang.ThreadDeath
  • 26 * @since JDK1.0
  • 27 */
  • 28public class Error extends Throwable {
  • 29 static final long serialVersionUID = 4980196508277280342L;
  • 30
  • 31 /**
  • 32 * Constructs a new error with <code>null</code> as its detail message.
  • 33 * The cause is not initialized, and may subsequently be initialized by a
  • 34 * call to {@link #initCause}.
  • 35 */
  • 36 public Error() {
  • 37 super();
  • 38 }
  • 39
  • 40 /**
  • 41 * Constructs a new error with the specified detail message. The
  • 42 * cause is not initialized, and may subsequently be initialized by
  • 43 * a call to {@link #initCause}.
  • 44 *
  • 45 * @param message the detail message. The detail message is saved for
  • 46 * later retrieval by the {@link #getMessage()} method.
  • 47 */
  • 48 public Error(String message) {
  • 49 super(message);
  • 50 }
  • 51
  • 52 /**
  • 53 * Constructs a new error with the specified detail message and
  • 54 * cause. <p>Note that the detail message associated with
  • 55 * <code>cause</code> is <i>not</i> automatically incorporated in
  • 56 * this error's detail message.
  • 57 *
  • 58 * @param message the detail message (which is saved for later retrieval
  • 59 * by the {@link #getMessage()} method).
  • 60 * @param cause the cause (which is saved for later retrieval by the
  • 61 * {@link #getCause()} method). (A <tt>null</tt> value is
  • 62 * permitted, and indicates that the cause is nonexistent or
  • 63 * unknown.)
  • 64 * @since 1.4
  • 65 */
  • 66 public Error(String message, Throwable cause) {
  • 67 super(message, cause);
  • 68 }
  • 69
  • 70 /**
  • 71 * Constructs a new error with the specified cause and a detail
  • 72 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
  • 73 * typically contains the class and detail message of <tt>cause</tt>).
  • 74 * This constructor is useful for errors that are little more than
  • 75 * wrappers for other throwables.
  • 76 *
  • 77 * @param cause the cause (which is saved for later retrieval by the
  • 78 * {@link #getCause()} method). (A <tt>null</tt> value is
  • 79 * permitted, and indicates that the cause is nonexistent or
  • 80 * unknown.)
  • 81 * @since 1.4
  • 82 */
  • 83 public Error(Throwable cause) {
  • 84 super(cause);
  • 85 }
  • 86}

文件:Error.java
包名:java.lang
类名:Error
继承:Throwable
接口: