1 37 38 package net.sourceforge.cruisecontrol; 39 40 import java.io.PrintStream ; 41 import java.io.PrintWriter ; 42 43 public class CruiseControlException extends Exception { 44 private Throwable cause; 45 46 public CruiseControlException() { 47 super(); 48 } 49 50 public CruiseControlException(String message) { 51 super(message); 52 } 53 54 public CruiseControlException(Throwable cause) { 55 super(cause.getMessage()); 56 this.cause = cause; 57 } 58 59 public CruiseControlException(String message, Throwable cause) { 60 super(message + " : " + cause.getMessage()); 61 } 62 63 public void printStackTrace() { 64 super.printStackTrace(); 65 66 if (cause != null) { 67 System.err.println("Caused by:"); 68 cause.printStackTrace(); 69 } 70 } 71 72 public void printStackTrace(PrintStream printStream) { 73 super.printStackTrace(printStream); 74 75 if (cause != null) { 76 printStream.println("Caused by:"); 77 cause.printStackTrace(printStream); 78 } 79 } 80 81 public void printStackTrace(PrintWriter printWriter) { 82 super.printStackTrace(printWriter); 83 84 if (cause != null) { 85 printWriter.println("Caused by:"); 86 cause.printStackTrace(printWriter); 87 } 88 } 89 90 } 91 | Popular Tags |