1 17 18 19 20 package org.apache.fop.render.afp.exceptions; 21 22 import java.io.PrintStream ; 23 import java.io.PrintWriter ; 24 25 32 public abstract class NestedRuntimeException extends RuntimeException { 33 34 35 private Throwable _underlyingException; 36 37 41 public NestedRuntimeException(String msg) { 42 super(msg); 43 } 44 45 51 public NestedRuntimeException(String msg, Throwable t) { 52 super(msg); 53 _underlyingException = t; 54 55 } 56 57 61 public Throwable getUnderlyingException() { 62 63 return _underlyingException; 64 65 } 66 67 72 public String getMessage() { 73 74 if (_underlyingException == null) { 75 return super.getMessage(); 76 } else { 77 return super.getMessage() 78 + "; nested exception is " 79 + _underlyingException.getClass().getName(); 80 } 81 82 } 83 84 88 public void printStackTrace(PrintStream ps) { 89 if (_underlyingException == null) { 90 super.printStackTrace(ps); 91 } else { 92 ps.println(this); 93 _underlyingException.printStackTrace(ps); 94 } 95 } 96 97 101 public void printStackTrace(PrintWriter pw) { 102 if (_underlyingException == null) { 103 super.printStackTrace(pw); 104 } else { 105 pw.println(this); 106 _underlyingException.printStackTrace(pw); 107 } 108 } 109 110 } 111 | Popular Tags |