001: package de.webman.util.registry;
002:
003: import java.io.PrintStream;
004: import java.io.PrintWriter;
005:
006: /**
007: * This exception is thrown if any failure in the registry system has to be
008: * reported.
009: *
010: * @author <a href="mailto:gregor@webman.de">Gregor Klinke</a>
011: * @version $Revision: 1.2 $
012: **/
013: public class RegistryException extends Exception {
014: /* $Id: RegistryException.java,v 1.2 2002/04/12 12:30:24 gregor Exp $ */
015:
016: /**
017: * The cause for this exception.
018: */
019: private Exception cause = null;
020:
021: /**
022: * constructor
023: **/
024: public RegistryException() {
025: }
026:
027: public RegistryException(String s) {
028: super (s);
029: }
030:
031: public RegistryException(Exception _cause) {
032: cause = _cause;
033: }
034:
035: /**
036: * Returns the error message of this exception.
037: *
038: * @return the error message of this exception.
039: */
040: public String getMessage() {
041: return (cause == null ? super .getMessage() : cause.getMessage());
042: }
043:
044: /**
045: * Returns the localized description of this exception.
046: *
047: * @return the localized description of this exception.
048: */
049: public String getLocalizedMessage() {
050: return (cause == null ? super .getLocalizedMessage() : cause
051: .getLocalizedMessage());
052: }
053:
054: /**
055: * Returns the short description of this exception.
056: *
057: * @return the short description of this exception.
058: */
059: public String toString() {
060: return (cause == null ? super .toString() : cause.toString());
061: }
062:
063: /**
064: * Prints this exception and its backtrace to the
065: * standard error stream.
066: */
067: public void printStackTrace() {
068: if (cause == null) {
069: super .printStackTrace();
070: } else {
071: printStackTrace();
072: }
073: }
074:
075: /**
076: * Prints this exception and its backtrace to the
077: * given print stream.
078: *
079: * @param ps the print stream.
080: */
081: public void printStackTrace(PrintStream ps) {
082: if (cause == null) {
083: super .printStackTrace(ps);
084: } else {
085: cause.printStackTrace(ps);
086: }
087: }
088:
089: /**
090: * Prints this exception and its backtrace to the
091: * given print writer.
092: *
093: * @param ps the print writer.
094: */
095: public void printStackTrace(PrintWriter pw) {
096: if (cause == null) {
097: super.printStackTrace(pw);
098: } else {
099: cause.printStackTrace(pw);
100: }
101: }
102: }
|