1 18 package sync4j.framework.core; 19 20 import java.io.PrintStream ; 21 import java.io.PrintWriter ; 22 23 import java.text.MessageFormat ; 24 25 26 34 public class Sync4jException extends Exception { 35 Throwable cause; 36 37 41 public Sync4jException(final String strMsg) { 42 super(strMsg); 43 } 44 45 51 public Sync4jException(final String strMsg, final Object [] aobjArgs) { 52 super(MessageFormat.format(strMsg, aobjArgs)); 53 } 54 55 public Sync4jException(final String strMsg, final Throwable cause) { 56 super(strMsg); 57 58 this.cause = cause; 59 } 60 61 public Sync4jException(final Throwable cause) { 62 this("", cause); 63 } 64 65 public Throwable getCause() { 66 return cause; 67 } 68 69 public void printStackTrace() { 70 super.printStackTrace(); 71 if (cause != null) { 72 System.err.println("Caused by:"); 73 cause.printStackTrace(); 74 } 75 } 76 77 public void printStackTrace(PrintStream ps) { 78 super.printStackTrace(ps); 79 if (cause != null) { 80 System.err.println("Caused by:"); 81 cause.printStackTrace(ps); 82 } 83 } 84 85 public void printStackTrace(PrintWriter pw) { 86 super.printStackTrace(pw); 87 if (cause != null) { 88 System.err.println("Caused by:"); 89 cause.printStackTrace(pw); 90 } 91 } 92 } | Popular Tags |