1 44 45 package org.jfree.util; 46 47 import java.io.PrintStream ; 48 import java.io.PrintWriter ; 49 50 59 public class StackableRuntimeException extends RuntimeException { 60 61 62 private Exception parent; 63 64 67 public StackableRuntimeException() { 68 super(); 69 } 70 71 77 public StackableRuntimeException(final String message, final Exception ex) { 78 super(message); 79 this.parent = ex; 80 } 81 82 87 public StackableRuntimeException(final String message) { 88 super(message); 89 } 90 91 96 public Exception getParent() { 97 return this.parent; 98 } 99 100 105 public void printStackTrace(final PrintStream stream) { 106 super.printStackTrace(stream); 107 if (getParent() != null) { 108 stream.println("ParentException: "); 109 getParent().printStackTrace(stream); 110 } 111 } 112 113 118 public void printStackTrace(final PrintWriter writer) { 119 super.printStackTrace(writer); 120 if (getParent() != null) { 121 writer.println("ParentException: "); 122 getParent().printStackTrace(writer); 123 } 124 } 125 126 } 127 | Popular Tags |