KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > util > throwable > v1 > IChainableException


1 /*
2  * @(#)IChainableException.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Part of the GroboUtils package at:
9  * http://groboutils.sourceforge.net
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in
19  * all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */

29 package net.sourceforge.groboutils.util.throwable.v1;
30
31
32 import java.io.PrintStream JavaDoc;
33 import java.io.PrintWriter JavaDoc;
34
35
36 /**
37  * Marker interface to tell the <tt>ChainableExceptionHelper</tt> not to use
38  * this class's getCause method.
39  *
40  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
41  * @version $Date: 2003/02/10 22:52:38 $
42  * @since July 7, 2002
43  */

44 public interface IChainableException
45 {
46     // list all methods that must be re-implemented in the exception.
47

48     /**
49      * JDK 1.4 compatible method.
50      * <P>
51      * <i>from the JDK 1.4 documentation:</i>
52      * <BLOCKQUOTE>
53      * Returns the cause of this throwable or <tt>null</tt> if the cause is
54      * nonexistent or unknown. (The cause is the throwable that caused this
55      * throwable to get thrown.)
56      * <P>
57      * This implementation returns the cause that was supplied via one of the
58      * constructors requiring a <tt>Throwable</tt>, or that was set after
59      * creation with the <tt>initCause( Throwable )</tt> method. While it is
60      * typically unnecessary to override this method, a subclass can override
61      * it to return a cause set by some other means. This is appropriate for a
62      * "legacy chained throwable" that predates the addition of chained
63      * exceptions to <tt>Throwable</tt>. Note that it is not necessary to
64      * override any of the <tt>PrintStackTrace</tt> methods, all of which
65      * invoke the getCause method to determine the cause of a throwable.
66      * </BLOCKQUOTE>
67      *
68      * @return the cause of this throwable or <tt>null</tt> if the cause is
69      * nonexistent or unknown.
70      */

71     public Throwable JavaDoc getCause();
72     
73     
74     /**
75      * JDK 1.4 compatible method.
76      * <P>
77      * <i>from the JDK 1.4 documentation:</i>
78      * <BLOCKQUOTE>
79      * Initializes the cause of this throwable to the specified value.
80      * (The cause is the throwable that caused this throwable to get thrown.)
81      * <P>
82      * This method can be called at most once. It is generally called from
83      * within the constructor, or immediately after creating the throwable.
84      * If this throwable was created with Throwable(Throwable) or
85      * Throwable(String,Throwable), this method cannot be called even once.
86      * </BLOCKQUOTE>
87      *
88      * @param cause the cause (which is saved for later retrieval by the
89      * getCause() method). (A null value is permitted, and indicates
90      * that the cause is nonexistent or unknown.)
91      * @return a reference to this Throwable instance.
92      * @exception IllegalArgumentException if cause is this throwable.
93      * (A throwable cannot be its own cause.)
94      * @exception IllegalStateException if this throwable was created with
95      * Throwable(Throwable) or Throwable(String,Throwable), or this
96      * method has already been called on this throwable.
97      */

98     public Throwable JavaDoc initCause( Throwable JavaDoc cause );
99     
100     
101     /**
102      * For non-JDK 1.4 compatible VMs, this overrides the original behavior
103      * to describe the underlying cause. Special logic is performed to ensure
104      * that no JDK 1.4 VM is being used when the inner exception is displayed
105      * (in order to prevent double printing).
106      */

107     public void printStackTrace( PrintStream JavaDoc ps );
108     
109     
110     
111     /**
112      * For non-JDK 1.4 compatible VMs, this overrides the original behavior
113      * to describe the underlying cause. Special logic is performed to ensure
114      * that no JDK 1.4 VM is being used when the inner exception is displayed
115      * (in order to prevent double printing).
116      */

117     public void printStackTrace( PrintWriter JavaDoc pw );
118 }
119
120
Popular Tags