KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > rmi > activation > ActivationException


1 /*
2  * @(#)ActivationException.java 1.24 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
8 package java.rmi.activation;
9
10 /**
11  * General exception used by the activation interfaces.
12  *
13  * <p>As of release 1.4, this exception has been retrofitted to conform to
14  * the general purpose exception-chaining mechanism. The "detail exception"
15  * that may be provided at construction time and accessed via the public
16  * {@link #detail} field is now known as the <i>cause</i>, and may be
17  * accessed via the {@link Throwable#getCause()} method, as well as
18  * the aforementioned "legacy field."
19  *
20  * <p>Invoking the method {@link Throwable#initCause(Throwable)} on an
21  * instance of <code>ActivationException</code> always throws {@link
22  * IllegalStateException}.
23  *
24  * @author Ann Wollrath
25  * @version 1.24, 12/19/03
26  * @since 1.2
27  */

28 public class ActivationException extends Exception JavaDoc {
29
30     /**
31      * The cause of the activation exception.
32      *
33      * <p>This field predates the general-purpose exception chaining facility.
34      * The {@link Throwable#getCause()} method is now the preferred means of
35      * obtaining this information.
36      *
37      * @serial
38      */

39     public Throwable JavaDoc detail;
40
41     /** indicate compatibility with the Java 2 SDK v1.2 version of class */
42     private static final long serialVersionUID = -4320118837291406071L;
43
44     /**
45      * Constructs an <code>ActivationException</code>.
46      */

47     public ActivationException() {
48         initCause(null); // Disallow subsequent initCause
49
}
50
51     /**
52      * Constructs an <code>ActivationException</code> with the specified
53      * detail message.
54      *
55      * @param s the detail message
56      */

57     public ActivationException(String JavaDoc s) {
58     super(s);
59         initCause(null); // Disallow subsequent initCause
60
}
61
62     /**
63      * Constructs an <code>ActivationException</code> with the specified
64      * detail message and cause. This constructor sets the {@link #detail}
65      * field to the specified <code>Throwable</code>.
66      *
67      * @param s the detail message
68      * @param cause the cause
69      */

70     public ActivationException(String JavaDoc s, Throwable JavaDoc cause) {
71     super(s);
72         initCause(null); // Disallow subsequent initCause
73
detail = cause;
74     }
75
76     /**
77      * Returns the detail message, including the message from the cause, if
78      * any, of this exception.
79      *
80      * @return the detail message
81      */

82     public String JavaDoc getMessage() {
83     if (detail == null)
84         return super.getMessage();
85     else
86         return super.getMessage() +
87         "; nested exception is: \n\t" +
88         detail.toString();
89     }
90
91     /**
92      * Returns the cause of this exception. This method returns the value
93      * of the {@link #detail} field.
94      *
95      * @return the cause, which may be <tt>null</tt>.
96      * @since 1.4
97      */

98     public Throwable JavaDoc getCause() {
99         return detail;
100     }
101 }
102
Popular Tags