01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 BBNT Solutions, LLC
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26:
27: package org.cougaar.core.blackboard;
28:
29: /**
30: * An {@link IllegalArgumentException} for invalid or failed publish
31: * operations.
32: * <p>
33: * This class records additional information to assist the Blackboard
34: * in providing a more detailed explanation of the error, including
35: * the stack of a previous operation with which the current publish
36: * operation seems to be in conflict.
37: */
38: public class PublishException extends IllegalArgumentException {
39: public PublishStack priorStack;
40: public boolean priorStackUnavailable;
41: private String specialMessage = null;
42:
43: public PublishException(String msg) {
44: super (msg);
45: this .priorStack = null;
46: }
47:
48: public PublishException(String msg, PublishStack priorStack,
49: boolean priorStackUnavailable) {
50: super (msg);
51: this .priorStack = priorStack;
52: this .priorStackUnavailable = priorStackUnavailable;
53: }
54:
55: public String toString() {
56: if (specialMessage != null)
57: return specialMessage;
58: return super .toString();
59: }
60:
61: public synchronized void printStackTrace(String message) {
62: specialMessage = message;
63: super .printStackTrace();
64: specialMessage = null;
65: }
66:
67: public synchronized void printStackTrace() {
68: super .printStackTrace();
69: }
70:
71: public synchronized void printStackTrace(java.io.PrintStream s) {
72: super .printStackTrace(s);
73: }
74:
75: public synchronized void printStackTrace(java.io.PrintWriter s) {
76: super.printStackTrace(s);
77: }
78: }
|