01: package org.shiftone.cache;
02:
03: import java.io.PrintStream;
04: import java.io.PrintWriter;
05:
06: /**
07: * @version $Revision: 1.3 $
08: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
09: */
10: public class CacheException extends Exception {
11:
12: private Throwable rootCause;
13:
14: public CacheException(String message) {
15: super (message);
16: }
17:
18: public CacheException(String message, Throwable rootCause) {
19: super (message);
20: }
21:
22: public CacheException(Throwable rootCause) {
23:
24: super (rootCause.getMessage());
25:
26: this .rootCause = rootCause;
27: }
28:
29: public Throwable getRootCause() {
30: return rootCause;
31: }
32:
33: public void printStackTrace() {
34: printStackTrace(System.out);
35: }
36:
37: public void printStackTrace(PrintStream s) {
38: printStackTrace(new PrintWriter(s));
39: }
40:
41: public void printStackTrace(PrintWriter s) {
42:
43: super .printStackTrace(s);
44:
45: if (rootCause != null) {
46: s.println("*** Root cause is :");
47: rootCause.printStackTrace(s);
48: }
49:
50: s.flush();
51: }
52: }
|