1 package org.shiftone.cache; 2 3 4 5 import java.io.PrintStream ; 6 import java.io.PrintWriter ; 7 8 9 13 public class CacheException extends Exception 14 { 15 16 private Throwable rootCause; 17 18 public CacheException(String message) 19 { 20 super(message); 21 } 22 23 24 public CacheException(String message, Throwable rootCause) 25 { 26 super(message); 27 } 28 29 30 public CacheException(Throwable rootCause) 31 { 32 33 super(rootCause.getMessage()); 34 35 this.rootCause = rootCause; 36 } 37 38 39 public Throwable getRootCause() 40 { 41 return rootCause; 42 } 43 44 45 public void printStackTrace() 46 { 47 printStackTrace(System.out); 48 } 49 50 51 public void printStackTrace(PrintStream s) 52 { 53 printStackTrace(new PrintWriter (s)); 54 } 55 56 57 public void printStackTrace(PrintWriter s) 58 { 59 60 super.printStackTrace(s); 61 62 if (rootCause != null) 63 { 64 s.println("*** Root cause is :"); 65 rootCause.printStackTrace(s); 66 } 67 68 s.flush(); 69 } 70 } 71 | Popular Tags |