01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: /*
06: * Created by IntelliJ IDEA.
07: * User: plightbo
08: * Date: Apr 29, 2002
09: * Time: 10:46:56 PM
10: */
11: package com.opensymphony.workflow;
12:
13: import java.io.PrintStream;
14: import java.io.PrintWriter;
15:
16: /**
17: * A runtime exceptiont that singals a serious and unexpected error in OSWorkflow.
18: *
19: * @author <a href="mailto:plightbo@hotmail.com">Pat Lightbody</a>
20: */
21: public class InternalWorkflowException extends RuntimeException {
22: //~ Instance fields ////////////////////////////////////////////////////////
23:
24: private Throwable rootCause;
25:
26: //~ Constructors ///////////////////////////////////////////////////////////
27:
28: public InternalWorkflowException() {
29: }
30:
31: public InternalWorkflowException(String s) {
32: super (s);
33: }
34:
35: public InternalWorkflowException(String s, Throwable rootCause) {
36: super (s);
37: this .rootCause = rootCause;
38: }
39:
40: public InternalWorkflowException(Throwable rootCause) {
41: this .rootCause = rootCause;
42: }
43:
44: //~ Methods ////////////////////////////////////////////////////////////////
45:
46: public Throwable getRootCause() {
47: return rootCause;
48: }
49:
50: public void printStackTrace() {
51: super .printStackTrace();
52:
53: if (rootCause != null) {
54: synchronized (System.err) {
55: System.err.println("\nRoot cause:");
56: rootCause.printStackTrace();
57: }
58: }
59: }
60:
61: public void printStackTrace(PrintStream s) {
62: super .printStackTrace(s);
63:
64: if (rootCause != null) {
65: synchronized (s) {
66: s.println("\nRoot cause:");
67: rootCause.printStackTrace(s);
68: }
69: }
70: }
71:
72: public void printStackTrace(PrintWriter s) {
73: super .printStackTrace(s);
74:
75: if (rootCause != null) {
76: synchronized (s) {
77: s.println("\nRoot cause:");
78: rootCause.printStackTrace(s);
79: }
80: }
81: }
82: }
|