1 package com.protomatter.util; 2 3 52 53 import java.io.*; 54 import java.text.*; 55 56 59 public class ChainedException 60 extends Exception 61 { 62 private Throwable nextException = null; 63 64 public ChainedException(String message) 65 { 66 super(message); 67 } 68 69 public ChainedException(String message, Throwable nextException) 70 { 71 this(message); 72 this.nextException = nextException; 73 } 74 75 public Throwable getNextException() 76 { 77 return this.nextException; 78 } 79 80 public void printStackTrace() 81 { 82 super.printStackTrace(); 83 if (nextException != null) 84 { 85 System.err.print(UtilResources.getResourceString(MessageConstants.CAUSED_BY) + " "); 86 nextException.printStackTrace(); 87 } 88 } 89 90 public void printStackTrace(java.io.PrintStream ps) 91 { 92 super.printStackTrace(ps); 93 if (nextException != null) 94 { 95 ps.print(UtilResources.getResourceString(MessageConstants.CAUSED_BY) + " "); 96 nextException.printStackTrace(ps); 97 } 98 } 99 100 public void printStackTrace(java.io.PrintWriter pw) 101 { 102 super.printStackTrace(pw); 103 if (nextException != null) 104 { 105 pw.print(UtilResources.getResourceString(MessageConstants.CAUSED_BY) + " "); 106 nextException.printStackTrace(pw); 107 } 108 } 109 } 110 | Popular Tags |