Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/rmi/activation/ActivationException.java
38918 views
/*1* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.rmi.activation;2627/**28* General exception used by the activation interfaces.29*30* <p>As of release 1.4, this exception has been retrofitted to conform to31* the general purpose exception-chaining mechanism. The "detail exception"32* that may be provided at construction time and accessed via the public33* {@link #detail} field is now known as the <i>cause</i>, and may be34* accessed via the {@link Throwable#getCause()} method, as well as35* the aforementioned "legacy field."36*37* <p>Invoking the method {@link Throwable#initCause(Throwable)} on an38* instance of <code>ActivationException</code> always throws {@link39* IllegalStateException}.40*41* @author Ann Wollrath42* @since 1.243*/44public class ActivationException extends Exception {4546/**47* The cause of the activation exception.48*49* <p>This field predates the general-purpose exception chaining facility.50* The {@link Throwable#getCause()} method is now the preferred means of51* obtaining this information.52*53* @serial54*/55public Throwable detail;5657/** indicate compatibility with the Java 2 SDK v1.2 version of class */58private static final long serialVersionUID = -4320118837291406071L;5960/**61* Constructs an <code>ActivationException</code>.62*/63public ActivationException() {64initCause(null); // Disallow subsequent initCause65}6667/**68* Constructs an <code>ActivationException</code> with the specified69* detail message.70*71* @param s the detail message72*/73public ActivationException(String s) {74super(s);75initCause(null); // Disallow subsequent initCause76}7778/**79* Constructs an <code>ActivationException</code> with the specified80* detail message and cause. This constructor sets the {@link #detail}81* field to the specified <code>Throwable</code>.82*83* @param s the detail message84* @param cause the cause85*/86public ActivationException(String s, Throwable cause) {87super(s);88initCause(null); // Disallow subsequent initCause89detail = cause;90}9192/**93* Returns the detail message, including the message from the cause, if94* any, of this exception.95*96* @return the detail message97*/98public String getMessage() {99if (detail == null)100return super.getMessage();101else102return super.getMessage() +103"; nested exception is: \n\t" +104detail.toString();105}106107/**108* Returns the cause of this exception. This method returns the value109* of the {@link #detail} field.110*111* @return the cause, which may be <tt>null</tt>.112* @since 1.4113*/114public Throwable getCause() {115return detail;116}117}118119120