Save This Page
Home » openjdk-7 » java » lang » [javadoc | source]
    1   /*
    2    * Copyright 1994-2000 Sun Microsystems, Inc.  All Rights Reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package java.lang;
   27   
   28   /**
   29    * The class <code>Exception</code> and its subclasses are a form of
   30    * <code>Throwable</code> that indicates conditions that a reasonable
   31    * application might want to catch.
   32    *
   33    * @author  Frank Yellin
   34    * @see     java.lang.Error
   35    * @since   JDK1.0
   36    */
   37   public class Exception extends Throwable {
   38       static final long serialVersionUID = -3387516993124229948L;
   39   
   40       /**
   41        * Constructs a new exception with <code>null</code> as its detail message.
   42        * The cause is not initialized, and may subsequently be initialized by a
   43        * call to {@link #initCause}.
   44        */
   45       public Exception() {
   46           super();
   47       }
   48   
   49       /**
   50        * Constructs a new exception with the specified detail message.  The
   51        * cause is not initialized, and may subsequently be initialized by
   52        * a call to {@link #initCause}.
   53        *
   54        * @param   message   the detail message. The detail message is saved for
   55        *          later retrieval by the {@link #getMessage()} method.
   56        */
   57       public Exception(String message) {
   58           super(message);
   59       }
   60   
   61       /**
   62        * Constructs a new exception with the specified detail message and
   63        * cause.  <p>Note that the detail message associated with
   64        * <code>cause</code> is <i>not</i> automatically incorporated in
   65        * this exception's detail message.
   66        *
   67        * @param  message the detail message (which is saved for later retrieval
   68        *         by the {@link #getMessage()} method).
   69        * @param  cause the cause (which is saved for later retrieval by the
   70        *         {@link #getCause()} method).  (A <tt>null</tt> value is
   71        *         permitted, and indicates that the cause is nonexistent or
   72        *         unknown.)
   73        * @since  1.4
   74        */
   75       public Exception(String message, Throwable cause) {
   76           super(message, cause);
   77       }
   78   
   79       /**
   80        * Constructs a new exception with the specified cause and a detail
   81        * message of <tt>(cause==null ? null : cause.toString())</tt> (which
   82        * typically contains the class and detail message of <tt>cause</tt>).
   83        * This constructor is useful for exceptions that are little more than
   84        * wrappers for other throwables (for example, {@link
   85        * java.security.PrivilegedActionException}).
   86        *
   87        * @param  cause the cause (which is saved for later retrieval by the
   88        *         {@link #getCause()} method).  (A <tt>null</tt> value is
   89        *         permitted, and indicates that the cause is nonexistent or
   90        *         unknown.)
   91        * @since  1.4
   92        */
   93       public Exception(Throwable cause) {
   94           super(cause);
   95       }
   96   }

Save This Page
Home » openjdk-7 » java » lang » [javadoc | source]