1 27 package org.objectweb.speedo.api; 28 29 import java.io.PrintStream ; 30 import java.io.PrintWriter ; 31 32 35 public class SpeedoException extends Exception { 36 37 protected Exception nestedException; 38 39 public SpeedoException() { 40 } 41 42 public SpeedoException(String s) { 43 super(s); 44 } 45 46 public SpeedoException(Exception nested) { 47 this.nestedException = nested; 48 } 49 50 public SpeedoException(String s, Exception nested) { 51 super(s); 52 this.nestedException = nested; 53 } 54 55 public Exception getNestedException() { 56 return nestedException; 57 } 58 59 public void printStackTrace(PrintStream stream) { 60 if (nestedException != null) { 61 stream.println(getMessage()); 62 nestedException.printStackTrace(stream); 63 } else 64 super.printStackTrace(stream); 65 } 66 67 public void printStackTrace(PrintWriter writer) { 68 if (nestedException != null) { 69 writer.println(getMessage()); 70 nestedException.printStackTrace(writer); 71 } else 72 super.printStackTrace(writer); 73 } 74 75 public void printStackTrace() { 76 printStackTrace(System.out); 77 } 78 } 79 | Popular Tags |