1 44 45 package org.jfree.util; 46 47 import java.io.PrintStream ; 48 import java.io.PrintWriter ; 49 50 61 public abstract class StackableException extends Exception { 62 63 64 private Exception parent; 65 66 69 public StackableException() { 70 super(); 71 } 72 73 79 public StackableException(final String message, final Exception ex) { 80 super(message); 81 this.parent = ex; 82 } 83 84 89 public StackableException(final String message) { 90 super(message); 91 } 92 93 98 public Exception getParent() { 99 return this.parent; 100 } 101 102 107 public void printStackTrace(final PrintStream stream) { 108 super.printStackTrace(stream); 109 if (getParent() != null) { 110 stream.println("ParentException: "); 111 getParent().printStackTrace(stream); 112 } 113 } 114 115 120 public void printStackTrace(final PrintWriter writer) { 121 super.printStackTrace(writer); 122 if (getParent() != null) { 123 writer.println("ParentException: "); 124 getParent().printStackTrace(writer); 125 } 126 } 127 128 164 public void printStackTrace() { 165 synchronized (System.err) { 166 printStackTrace(System.err); 167 } 168 } 169 } 170 | Popular Tags |