1 19 package javax.util.jcache; 20 21 24 public class CacheException extends Exception { 25 26 private final Exception base; 27 private String message; 28 29 32 public CacheException() { 33 this.base = null; 34 } 35 36 public String getLocalizedMessage() { 37 return message==null?super.getLocalizedMessage():message; 38 } 39 public String getMessage() { 40 return message==null?super.getMessage():message; 41 } 42 49 public CacheException(final String message, final Exception cause) { 50 super(message); 51 this.base = cause; 52 } 53 54 60 public CacheException(final Exception cause) { 61 super(); 62 this.base = cause; 63 } 64 65 71 public CacheException(final String msg) { 72 super(msg); 73 this.base = null; 74 } 75 76 82 public final void printStackTrace() { 83 super.printStackTrace(); 84 if (base != null) { 85 System.err.println("CAUSED BY:"); 86 base.printStackTrace(); 87 } 88 } 89 90 95 public final Exception getBase() { 96 return base; 97 } 98 99 public void setMessage(String message) { 100 this.message=message; 101 } 102 } 103 | Popular Tags |