01: /**
02: * $Id: WSRPException.java,v 1.2 2003/12/19 22:46:23 jtb Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wsrp;
14:
15: import java.lang.Exception;
16:
17: import java.io.PrintWriter;
18: import java.io.BufferedReader;
19: import java.io.PrintStream;
20: import java.io.PrintWriter;
21:
22: /**
23: * A WSRPException is thrown when there is an unrecoverable error
24: * in WSRP implementation.
25: **/
26: public class WSRPException extends Exception {
27:
28: protected Throwable wrapped = null;
29:
30: /**
31: * Constructs a new exception with the specified message, indicating an
32: * error in the provider as happened.<br><br>
33: *
34: * @param msg The descriptive message.
35: */
36: public WSRPException(String msg) {
37: super (msg);
38: }
39:
40: /**
41: * Constructs a new exception with the specified message, and the original
42: * <code>exception</code> or <code>error</code>, indicating an error in the
43: * WSRP as happened.<br><br>
44: *
45: * @param msg The descriptive message.
46: * @param e The original <code>exception</code> or <code>error</code>.
47: */
48: public WSRPException(String msg, Throwable t) {
49: super (msg);
50: wrapped = t;
51: }
52:
53: public WSRPException(Throwable t) {
54: super ();
55: wrapped = t;
56: }
57:
58: public Throwable getWrapped() {
59: return wrapped;
60: }
61:
62: public String toString() {
63: StringBuffer b = new StringBuffer();
64:
65: b.append(super .toString());
66: if (getWrapped() != null) {
67: b.append(wrapped.toString());
68: }
69:
70: return b.toString();
71: }
72:
73: public void printStackTrace() {
74: super .printStackTrace();
75: if (getWrapped() != null) {
76: wrapped.printStackTrace();
77: }
78: }
79:
80: public void printStackTrace(PrintStream s) {
81: super .printStackTrace(s);
82: if (getWrapped() != null) {
83: wrapped.printStackTrace(s);
84: }
85: }
86:
87: public void printStackTrace(PrintWriter s) {
88: super.printStackTrace(s);
89: if (getWrapped() != null) {
90: wrapped.printStackTrace(s);
91: }
92: }
93: }
|