01: /*
02: * Copyright 2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11: * the license for the specific language governing your rights and limitations.
12: */
13: package org.pentaho.util;
14:
15: import java.io.PrintStream;
16:
17: /**
18: *
19: * @author Steven Barkdull
20: *
21: */
22: abstract public class PentahoCheckedChainedException extends Exception {
23:
24: /**
25: *
26: */
27: private static final long serialVersionUID = -666L;
28:
29: // private static final String CAUSEDBY = Messages.getString("PENTCHEXCEPT.ERROR_CAUSEDBY"); // Need to NLS... //$NON-NLS-1$
30:
31: public PentahoCheckedChainedException() {
32: super ();
33: }
34:
35: /**
36: * Constructor
37: *
38: * @param message
39: * The message to be carried by the exception.
40: */
41: public PentahoCheckedChainedException(String message) {
42: super (message);
43: }
44:
45: /**
46: * Constructor
47: *
48: * @param message
49: * The message.
50: * @param reas
51: * The root cause of the exception.
52: */
53: public PentahoCheckedChainedException(String message, Throwable reas) {
54: super (message, reas);
55: }
56:
57: /**
58: * Constructor
59: *
60: * @param reas
61: * The cause of this exception
62: */
63: public PentahoCheckedChainedException(Throwable reas) {
64: super (reas);
65: }
66:
67: /**
68: * Gets the root cause of the exception.
69: */
70: public Throwable getRootCause() {
71: Throwable aReason = this ;
72: Throwable lastReason = null;
73: while ((aReason != null)) {
74: lastReason = aReason;
75: aReason = aReason.getCause();
76: }
77: return (aReason != null) ? aReason : lastReason;
78: }
79:
80: /**
81: * Prints the exception trace to the specified print writer
82: */
83: public synchronized void printStackTrace(java.io.PrintWriter pw) {
84: super .printStackTrace(pw);
85: }
86:
87: /**
88: * Prints the exception trace to the specified print stream.
89: */
90: public synchronized void printStackTrace(PrintStream ps) {
91: super.printStackTrace(ps);
92: }
93: }
|