KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > exceptions > SequoiaException


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Mathieu Peltier.
21  * Contributor(s): _______________________.
22  */

23
24 package org.continuent.sequoia.common.exceptions;
25
26 import java.io.PrintStream JavaDoc;
27 import java.io.PrintWriter JavaDoc;
28 import java.io.Serializable JavaDoc;
29
30 /**
31  * Sequoia base exception.
32  *
33  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
34  * @version 1.0
35  */

36 public class SequoiaException extends Exception JavaDoc implements Serializable JavaDoc
37 {
38   private static final long serialVersionUID = -1899348090329064503L;
39
40   /** Optional exception cause */
41   protected Throwable JavaDoc cause;
42
43   /**
44    * Creates a new <code>SequoiaException</code> instance.
45    */

46   public SequoiaException()
47   {
48   }
49
50   /**
51    * Creates a new <code>SequoiaException</code> instance.
52    *
53    * @param message the error message
54    */

55   public SequoiaException(String JavaDoc message)
56   {
57     super(message);
58   }
59
60   /**
61    * Creates a new <code>SequoiaException</code> instance.
62    *
63    * @param cause the root cause
64    */

65   public SequoiaException(Throwable JavaDoc cause)
66   {
67     this.cause = cause;
68   }
69
70   /**
71    * Creates a new <code>SequoiaException</code> instance.
72    *
73    * @param message the error message
74    * @param cause the root cause
75    */

76   public SequoiaException(String JavaDoc message, Throwable JavaDoc cause)
77   {
78     super(message);
79     this.cause = cause;
80   }
81
82   /**
83    * Gets the root cause of this exception.
84    *
85    * @return a <code>Throwable</code> object
86    */

87   public Throwable JavaDoc getCause()
88   {
89     return cause;
90   }
91
92   /**
93    * @see java.lang.Throwable#fillInStackTrace()
94    */

95   public synchronized Throwable JavaDoc fillInStackTrace()
96   {
97     if (cause != null)
98     {
99       return cause.fillInStackTrace();
100     }
101     else
102     {
103       return super.fillInStackTrace();
104     }
105   }
106
107   /**
108    * @see java.lang.Throwable#getStackTrace()
109    */

110   public StackTraceElement JavaDoc[] getStackTrace()
111   {
112     if (cause != null)
113     {
114       return cause.getStackTrace();
115     }
116     else
117     {
118       return super.getStackTrace();
119     }
120   }
121
122   /**
123    * @see java.lang.Throwable#getMessage()
124    */

125   public String JavaDoc getMessage()
126   {
127     if (cause != null)
128     {
129       return cause.getMessage();
130     }
131     else
132     {
133       return super.getMessage();
134     }
135   }
136
137   /**
138    * @see java.lang.Throwable#printStackTrace()
139    */

140   public void printStackTrace()
141   {
142     if (cause != null)
143     {
144       cause.printStackTrace();
145     }
146     else
147     {
148       super.printStackTrace();
149     }
150   }
151
152   /**
153    * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
154    */

155   public void printStackTrace(PrintStream JavaDoc arg0)
156   {
157     if (cause != null)
158     {
159       cause.printStackTrace(arg0);
160     }
161     else
162     {
163       super.printStackTrace(arg0);
164     }
165   }
166
167   /**
168    * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
169    */

170   public void printStackTrace(PrintWriter JavaDoc arg0)
171   {
172     if (cause != null)
173     {
174       cause.printStackTrace(arg0);
175     }
176     else
177     {
178       super.printStackTrace(arg0);
179     }
180   }
181
182   /**
183    * @see java.lang.Throwable#setStackTrace(java.lang.StackTraceElement[])
184    */

185   public void setStackTrace(StackTraceElement JavaDoc[] arg0)
186   {
187     if (cause != null)
188     {
189       cause.setStackTrace(arg0);
190     }
191     else
192     {
193       super.setStackTrace(arg0);
194     }
195   }
196
197 }
198
Popular Tags