KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > pmti > v1 > ProblemManagerException


1 /*
2  * @(#)ProblemManagerException.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.pmti.v1;
30
31
32 import net.sourceforge.groboutils.util.throwable.v1.IChainableException;
33 import net.sourceforge.groboutils.util.throwable.v1.ChainableExceptionHelper;
34
35 import java.io.IOException JavaDoc;
36 import java.io.PrintStream JavaDoc;
37 import java.io.PrintWriter JavaDoc;
38
39
40 /**
41  * General exception thrown by the Problem Manager if an unexpected
42  * circumstance occurs.
43  *
44  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
45  * @version $Date: 2003/02/10 22:51:55 $
46  * @since July 7, 2002
47  */

48 public class ProblemManagerException extends IOException JavaDoc
49         implements IChainableException
50 {
51     /**
52      * @serial
53      */

54     private ChainableExceptionHelper ceh;
55     
56     
57     public ProblemManagerException()
58     {
59         super();
60         this.ceh = new ChainableExceptionHelper( this );
61     }
62     
63     
64     public ProblemManagerException( String JavaDoc message )
65     {
66         super( message );
67         this.ceh = new ChainableExceptionHelper( this );
68     }
69     
70     
71     public ProblemManagerException( Throwable JavaDoc cause )
72     {
73         super();
74         this.ceh = new ChainableExceptionHelper( this, cause );
75     }
76     
77     
78     public ProblemManagerException( Throwable JavaDoc cause, String JavaDoc message )
79     {
80         this( message, cause );
81     }
82     
83     
84     public ProblemManagerException( String JavaDoc message, Throwable JavaDoc cause )
85     {
86         super( message );
87         this.ceh = new ChainableExceptionHelper( this, cause );
88     }
89     
90     
91     /**
92      * JDK 1.4 compatible method.
93      * <P>
94      * <i>from the JDK 1.4 documentation:</i>
95      * <BLOCKQUOTE>
96      * Returns the cause of this throwable or <tt>null</tt> if the cause is
97      * nonexistent or unknown. (The cause is the throwable that caused this
98      * throwable to get thrown.)
99      * <P>
100      * This implementation returns the cause that was supplied via one of the
101      * constructors requiring a <tt>Throwable</tt>, or that was set after
102      * creation with the <tt>initCause( Throwable )</tt> method. While it is
103      * typically unnecessary to override this method, a subclass can override
104      * it to return a cause set by some other means. This is appropriate for a
105      * "legacy chained throwable" that predates the addition of chained
106      * exceptions to <tt>Throwable</tt>. Note that it is not necessary to
107      * override any of the <tt>PrintStackTrace</tt> methods, all of which
108      * invoke the getCause method to determine the cause of a throwable.
109      * </BLOCKQUOTE>
110      *
111      * @return the cause of this throwable or <tt>null</tt> if the cause is
112      * nonexistent or unknown.
113      */

114     public Throwable JavaDoc getCause()
115     {
116         return this.ceh.getCause();
117     }
118     
119     
120     /**
121      * JDK 1.4 compatible method.
122      * <P>
123      * <i>from the JDK 1.4 documentation:</i>
124      * <BLOCKQUOTE>
125      * Initializes the cause of this throwable to the specified value.
126      * (The cause is the throwable that caused this throwable to get thrown.)
127      * <P>
128      * This method can be called at most once. It is generally called from
129      * within the constructor, or immediately after creating the throwable.
130      * If this throwable was created with Throwable(Throwable) or
131      * Throwable(String,Throwable), this method cannot be called even once.
132      * </BLOCKQUOTE>
133      *
134      * @param cause the cause (which is saved for later retrieval by the
135      * getCause() method). (A null value is permitted, and indicates
136      * that the cause is nonexistent or unknown.)
137      * @return a reference to this Throwable instance.
138      * @exception IllegalArgumentException if cause is this throwable.
139      * (A throwable cannot be its own cause.)
140      * @exception IllegalStateException if this throwable was created with
141      * Throwable(Throwable) or Throwable(String,Throwable), or this
142      * method has already been called on this throwable.
143      */

144     public synchronized Throwable JavaDoc initCause( Throwable JavaDoc cause )
145     {
146         return this.ceh.initCause( cause );
147     }
148     
149     
150     /**
151      * For non-JDK 1.4 compatible VMs, this overrides the original behavior
152      * to describe the underlying cause. Special logic is performed to ensure
153      * that no JDK 1.4 VM is being used when the inner exception is displayed
154      * (in order to prevent double printing).
155      */

156     public void printStackTrace( PrintStream JavaDoc ps )
157     {
158         this.ceh.printStackTrace( ps );
159     }
160     
161     
162     
163     /**
164      * For non-JDK 1.4 compatible VMs, this overrides the original behavior
165      * to describe the underlying cause. Special logic is performed to ensure
166      * that no JDK 1.4 VM is being used when the inner exception is displayed
167      * (in order to prevent double printing).
168      */

169     public void printStackTrace( PrintWriter JavaDoc pw )
170     {
171         this.ceh.printStackTrace( pw );
172     }
173 }
174
175
Popular Tags