jaroslav@52: /* jaroslav@52: * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. jaroslav@52: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@52: * jaroslav@52: * This code is free software; you can redistribute it and/or modify it jaroslav@52: * under the terms of the GNU General Public License version 2 only, as jaroslav@52: * published by the Free Software Foundation. Oracle designates this jaroslav@52: * particular file as subject to the "Classpath" exception as provided jaroslav@52: * by Oracle in the LICENSE file that accompanied this code. jaroslav@52: * jaroslav@52: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@52: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@52: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@52: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@52: * accompanied this code). jaroslav@52: * jaroslav@52: * You should have received a copy of the GNU General Public License version jaroslav@52: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@52: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@52: * jaroslav@52: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@52: * or visit www.oracle.com if you need additional information or have any jaroslav@52: * questions. jaroslav@52: */ jaroslav@52: jaroslav@52: package java.lang; jaroslav@52: jaroslav@52: /** jaroslav@52: * The class {@code Exception} and its subclasses are a form of jaroslav@52: * {@code Throwable} that indicates conditions that a reasonable jaroslav@52: * application might want to catch. jaroslav@52: * jaroslav@52: *

The class {@code Exception} and any subclasses that are not also jaroslav@52: * subclasses of {@link RuntimeException} are checked jaroslav@52: * exceptions. Checked exceptions need to be declared in a jaroslav@52: * method or constructor's {@code throws} clause if they can be thrown jaroslav@52: * by the execution of the method or constructor and propagate outside jaroslav@52: * the method or constructor boundary. jaroslav@52: * jaroslav@52: * @author Frank Yellin jaroslav@52: * @see java.lang.Error jaroslav@52: * @jls 11.2 Compile-Time Checking of Exceptions jaroslav@52: * @since JDK1.0 jaroslav@52: */ jaroslav@52: public class Exception extends Throwable { jaroslav@52: static final long serialVersionUID = -3387516993124229948L; jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new exception with {@code null} as its detail message. jaroslav@52: * The cause is not initialized, and may subsequently be initialized by a jaroslav@52: * call to {@link #initCause}. jaroslav@52: */ jaroslav@52: public Exception() { jaroslav@52: super(); jaroslav@52: } jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new exception with the specified detail message. The jaroslav@52: * cause is not initialized, and may subsequently be initialized by jaroslav@52: * a call to {@link #initCause}. jaroslav@52: * jaroslav@52: * @param message the detail message. The detail message is saved for jaroslav@52: * later retrieval by the {@link #getMessage()} method. jaroslav@52: */ jaroslav@52: public Exception(String message) { jaroslav@52: super(message); jaroslav@52: } jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new exception with the specified detail message and jaroslav@52: * cause.

Note that the detail message associated with jaroslav@52: * {@code cause} is not automatically incorporated in jaroslav@52: * this exception's detail message. jaroslav@52: * jaroslav@52: * @param message the detail message (which is saved for later retrieval jaroslav@52: * by the {@link #getMessage()} method). jaroslav@52: * @param cause the cause (which is saved for later retrieval by the jaroslav@52: * {@link #getCause()} method). (A null value is jaroslav@52: * permitted, and indicates that the cause is nonexistent or jaroslav@52: * unknown.) jaroslav@52: * @since 1.4 jaroslav@52: */ jaroslav@52: public Exception(String message, Throwable cause) { jaroslav@52: super(message, cause); jaroslav@52: } jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new exception with the specified cause and a detail jaroslav@52: * message of (cause==null ? null : cause.toString()) (which jaroslav@52: * typically contains the class and detail message of cause). jaroslav@52: * This constructor is useful for exceptions that are little more than jaroslav@52: * wrappers for other throwables (for example, {@link jaroslav@52: * java.security.PrivilegedActionException}). jaroslav@52: * jaroslav@52: * @param cause the cause (which is saved for later retrieval by the jaroslav@52: * {@link #getCause()} method). (A null value is jaroslav@52: * permitted, and indicates that the cause is nonexistent or jaroslav@52: * unknown.) jaroslav@52: * @since 1.4 jaroslav@52: */ jaroslav@52: public Exception(Throwable cause) { jaroslav@52: super(cause); jaroslav@52: } jaroslav@52: jaroslav@52: /** jaroslav@52: * Constructs a new exception with the specified detail message, jaroslav@52: * cause, suppression enabled or disabled, and writable stack jaroslav@52: * trace enabled or disabled. jaroslav@52: * jaroslav@52: * @param message the detail message. jaroslav@52: * @param cause the cause. (A {@code null} value is permitted, jaroslav@52: * and indicates that the cause is nonexistent or unknown.) jaroslav@52: * @param enableSuppression whether or not suppression is enabled jaroslav@52: * or disabled jaroslav@52: * @param writableStackTrace whether or not the stack trace should jaroslav@52: * be writable jaroslav@52: * @since 1.7 jaroslav@52: */ jaroslav@52: protected Exception(String message, Throwable cause, jaroslav@52: boolean enableSuppression, jaroslav@52: boolean writableStackTrace) { jaroslav@52: super(message, cause, enableSuppression, writableStackTrace); jaroslav@52: } jaroslav@52: }