KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > InternalWorkflowException


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 /*
6  * Created by IntelliJ IDEA.
7  * User: plightbo
8  * Date: Apr 29, 2002
9  * Time: 10:46:56 PM
10  */

11 package com.opensymphony.workflow;
12
13 import java.io.PrintStream JavaDoc;
14 import java.io.PrintWriter JavaDoc;
15
16
17 /**
18  * A runtime exceptiont that singals a serious and unexpected error in OSWorkflow.
19  *
20  * @author <a HREF="mailto:plightbo@hotmail.com">Pat Lightbody</a>
21  */

22 public class InternalWorkflowException extends RuntimeException JavaDoc {
23     //~ Instance fields ////////////////////////////////////////////////////////
24

25     private Throwable JavaDoc rootCause;
26
27     //~ Constructors ///////////////////////////////////////////////////////////
28

29     public InternalWorkflowException() {
30     }
31
32     public InternalWorkflowException(String JavaDoc s) {
33         super(s);
34     }
35
36     public InternalWorkflowException(String JavaDoc s, Throwable JavaDoc rootCause) {
37         super(s);
38         this.rootCause = rootCause;
39     }
40
41     public InternalWorkflowException(Throwable JavaDoc rootCause) {
42         this.rootCause = rootCause;
43     }
44
45     //~ Methods ////////////////////////////////////////////////////////////////
46

47     public Throwable JavaDoc getRootCause() {
48         return rootCause;
49     }
50
51     public void printStackTrace() {
52         super.printStackTrace();
53
54         if (rootCause != null) {
55             synchronized (System.err) {
56                 System.err.println("\nRoot cause:");
57                 rootCause.printStackTrace();
58             }
59         }
60     }
61
62     public void printStackTrace(PrintStream JavaDoc s) {
63         super.printStackTrace(s);
64
65         if (rootCause != null) {
66             synchronized (s) {
67                 s.println("\nRoot cause:");
68                 rootCause.printStackTrace(s);
69             }
70         }
71     }
72
73     public void printStackTrace(PrintWriter JavaDoc s) {
74         super.printStackTrace(s);
75
76         if (rootCause != null) {
77             synchronized (s) {
78                 s.println("\nRoot cause:");
79                 rootCause.printStackTrace(s);
80             }
81         }
82     }
83 }
84
Popular Tags