KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > exception > JalistoException


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.exception;
25
26 import java.io.PrintStream JavaDoc;
27 import java.io.PrintWriter JavaDoc;
28
29 public class JalistoException extends RuntimeException JavaDoc {
30     public JalistoException() {
31         this.message = "";
32         this.cause = null;
33     }
34
35     public JalistoException(String JavaDoc s) {
36         this.message = s;
37         this.cause = null;
38     }
39
40     public JalistoException(Throwable JavaDoc t) {
41         this.message = "";
42         this.cause = t;
43     }
44
45     public JalistoException(String JavaDoc s, Throwable JavaDoc t) {
46         this.message = s;
47         this.cause = t;
48     }
49
50
51     public void printStackTrace() {
52         System.err.println("JalistoException : "+String.valueOf(message)+"\n");
53         if (cause != null) {
54             System.err.println("internal exception : \n");
55             cause.printStackTrace();
56         }
57     }
58
59     public void printStackTrace(PrintStream JavaDoc s) {
60         s.println("JalistoException : "+String.valueOf(message)+"\n");
61         if (cause != null) {
62             s.println("internal exception : \n");
63             cause.printStackTrace(s);
64         }
65     }
66
67     public void printStackTrace(PrintWriter JavaDoc s) {
68         s.println("JalistoException : "+String.valueOf(message)+"\n");
69         if (cause != null) {
70             s.println("internal exception : \n");
71             cause.printStackTrace(s);
72         }
73     }
74
75     public StackTraceElement JavaDoc[] getStackTrace() {
76         return cause.getStackTrace();
77     }
78
79     public void setStackTrace(StackTraceElement JavaDoc[] stackTrace) {
80         cause.setStackTrace(stackTrace);
81     }
82
83     public String JavaDoc getLocalizedMessage() {
84         return message;
85     }
86
87     public String JavaDoc getMessage() {
88         return message;
89     }
90
91     public String JavaDoc toString() {
92         return "JalistoException : "+String.valueOf(message);
93     }
94
95     public synchronized Throwable JavaDoc fillInStackTrace() {
96         return super.fillInStackTrace();
97     }
98
99     public Throwable JavaDoc getCause() {
100         return cause;
101     }
102
103     private String JavaDoc message;
104     private Throwable JavaDoc cause;
105 }
106
Popular Tags