01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.aspect.management;
05:
06: import java.io.PrintStream;
07: import java.io.PrintWriter;
08:
09: /**
10: * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
11: */
12: public class NoAspectBoundException extends RuntimeException {
13:
14: private String m_message;
15: private Throwable m_throwable;
16:
17: public NoAspectBoundException(String message, String aspectName) {
18: m_message = message + " - " + aspectName;
19: }
20:
21: public NoAspectBoundException(Throwable t, String aspectName) {
22: m_throwable = t;
23: m_message = t.getMessage();
24: }
25:
26: public String getMessage() {
27: StringBuffer sb = new StringBuffer("NoAspectBound: ");
28: sb.append(m_message);
29: return sb.toString();
30: }
31:
32: /**
33: * Returns the original exception.
34: *
35: * @return the cause
36: */
37: public Throwable getCause() {
38: if (m_throwable != null) {
39: return m_throwable;
40: } else {
41: return super .getCause();
42: }
43: }
44:
45: /**
46: * Prints the wrapped exception A its backtrace to the standard error stream.
47: */
48: public void printStackTrace() {
49: if (m_throwable != null) {
50: m_throwable.printStackTrace();
51: } else {
52: super .printStackTrace();
53: }
54: }
55:
56: /**
57: * Prints the wrapped excpetion A its backtrace to the specified print stream.
58: *
59: * @param s the print stream
60: */
61: public void printStackTrace(final PrintStream s) {
62: if (m_throwable != null) {
63: m_throwable.printStackTrace(s);
64: } else {
65: super .printStackTrace(s);
66: }
67: }
68:
69: /**
70: * Prints the wrapped exception A its backtrace to the specified print writer.
71: *
72: * @param s the print writer
73: */
74: public void printStackTrace(final PrintWriter s) {
75: if (m_throwable != null) {
76: m_throwable.printStackTrace(s);
77: } else {
78: super.printStackTrace(s);
79: }
80: }
81:
82: }
|