1 20 28 package org.columba.mail.spellcheck.cswilly; 29 30 import java.io.PrintStream ; 31 import java.io.PrintWriter ; 32 33 34 49 public class SpellException extends Exception { 50 51 protected Throwable rootCause; 52 53 58 public SpellException() { 59 super("Error occurred in spell application."); 60 } 61 62 70 public SpellException(String message) { 71 super(message); 72 } 73 74 86 public SpellException(String message, Throwable rootCause) { 87 super(message); 88 this.rootCause = rootCause; 89 } 90 91 100 public String getMessage() { 101 if (rootCause != null) { 102 return super.getMessage() + ": " + rootCause.getMessage(); 103 } else { 104 return super.getMessage(); 105 } 106 } 107 108 115 public void printStackTrace() { 116 super.printStackTrace(); 117 118 if (rootCause != null) { 119 System.err.print("Root cause: "); 120 rootCause.printStackTrace(); 121 } 122 } 123 124 131 public void printStackTrace(PrintStream s) { 132 super.printStackTrace(s); 133 134 if (rootCause != null) { 135 s.print("Root cause: "); 136 rootCause.printStackTrace(s); 137 } 138 } 139 140 147 public void printStackTrace(PrintWriter w) { 148 super.printStackTrace(w); 149 150 if (rootCause != null) { 151 w.print("Root cause: "); 152 rootCause.printStackTrace(w); 153 } 154 } 155 156 164 public Throwable getRootCause() { 165 return rootCause; 166 } 167 } 168 | Popular Tags |