1 10 package org.picocontainer; 11 12 import java.io.PrintStream ; 13 import java.io.PrintWriter ; 14 15 25 public abstract class PicoException extends RuntimeException { 26 29 private Throwable cause; 30 31 35 protected PicoException() { 36 } 37 38 44 protected PicoException(final String message) { 45 super(message); 46 } 47 48 53 protected PicoException(final Throwable cause) { 54 this.cause = cause; 55 } 56 57 63 protected PicoException(final String message, final Throwable cause) { 64 super(message); 65 this.cause = cause; 66 } 67 68 74 public Throwable getCause() { 75 return cause; 76 } 77 78 83 public void printStackTrace() { 84 printStackTrace(System.err); 85 } 86 87 90 public void printStackTrace(PrintStream s) { 91 super.printStackTrace(s); 92 if(cause!=null) { 93 s.println("Caused by:\n"); 94 cause.printStackTrace(s); 95 } 96 } 97 98 103 public void printStackTrace(PrintWriter s) { 104 super.printStackTrace(s); 105 if(cause!=null) { 106 s.println("Caused by:\n"); 107 cause.printStackTrace(s); 108 } 109 } 110 } 111 | Popular Tags |