001: /**
002: * $Id: ProviderProvisionException.java,v 1.2 2005/04/20 20:49:31 mjain Exp $
003: * Copyright 2005 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.providers.service.provision;
014:
015: import java.lang.Exception;
016:
017: import java.io.PrintWriter;
018: import java.io.BufferedReader;
019: import java.io.PrintStream;
020: import java.io.PrintWriter;
021:
022: /**
023: * A ProviderProvisionException is thrown when there is an unrecoverable error
024: * in implementation.
025: **/
026: public class ProviderProvisionException extends Exception {
027:
028: protected Throwable wrapped = null;
029: private String listenerName;
030:
031: /**
032: * Constructs a new exception with the specified message, indicating an
033: * error in the provider as happened.<br><br>
034: *
035: * @param msg The descriptive message.
036: */
037: public ProviderProvisionException(String listenerName, String msg) {
038: super (msg);
039: listenerName = listenerName;
040: }
041:
042: /**
043: * Constructs a new exception with the specified message, and the original
044: * <code>exception</code> or <code>error</code>, indicating an error in the
045: * implementation as happened.<br><br>
046: *
047: * @param msg The descriptive message.
048: * @param e The original <code>exception</code> or <code>error</code>.
049: */
050: public ProviderProvisionException(String listenerName, String msg,
051: Throwable t) {
052: super (msg);
053: wrapped = t;
054: listenerName = listenerName;
055: }
056:
057: public ProviderProvisionException(String listenerName, Throwable t) {
058: super ();
059: wrapped = t;
060: listenerName = listenerName;
061: }
062:
063: public Throwable getWrapped() {
064: return wrapped;
065: }
066:
067: public String toString() {
068: StringBuffer b = new StringBuffer();
069: b.append("Listener:" + listenerName);
070:
071: b.append(super .toString());
072: if (getWrapped() != null) {
073: b.append(wrapped.toString());
074: }
075:
076: return b.toString();
077: }
078:
079: public void printStackTrace() {
080: super .printStackTrace();
081: if (getWrapped() != null) {
082: wrapped.printStackTrace();
083: }
084:
085: }
086:
087: public void printStackTrace(PrintStream s) {
088: super .printStackTrace(s);
089: if (getWrapped() != null) {
090: wrapped.printStackTrace(s);
091: }
092: }
093:
094: public void printStackTrace(PrintWriter s) {
095: super.printStackTrace(s);
096: if (getWrapped() != null) {
097: wrapped.printStackTrace(s);
098: }
099: }
100: }
|