1 9 10 package com.opensymphony.module.sitemesh.factory; 11 12 import java.io.PrintStream ; 13 import java.io.PrintWriter ; 14 15 22 public class FactoryException extends RuntimeException { 23 protected Exception exception = null; 24 25 public FactoryException() { 26 super(); 27 } 28 29 public FactoryException(String msg) { 30 super(msg); 31 } 32 33 public FactoryException(Exception e) { 34 super(); 35 exception = e; 36 } 37 38 public FactoryException(String msg, Exception e) { 39 super(msg + ": " + e); 40 exception = e; 41 } 42 43 46 public Exception getRootCause() { 47 return exception; 48 } 49 50 public void printStackTrace() { 51 super.printStackTrace(); 52 if (exception != null) { 53 synchronized (System.err) { 54 System.err.println("\nRoot cause:"); 55 exception.printStackTrace(); 56 } 57 } 58 } 59 60 public void printStackTrace(PrintStream s) { 61 super.printStackTrace(s); 62 if (exception != null) { 63 synchronized (s) { 64 s.println("\nRoot cause:"); 65 exception.printStackTrace(s); 66 } 67 } 68 } 69 70 public void printStackTrace(PrintWriter s) { 71 super.printStackTrace(s); 72 if (exception != null) { 73 synchronized (s) { 74 s.println("\nRoot cause:"); 75 exception.printStackTrace(s); 76 } 77 } 78 } 79 } | Popular Tags |