01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.enterprise;
16:
17: /** Specialised exception -base for all other exceptions in this system */
18: public abstract class BaseException extends Exception {
19: /** Constructs BaseException object which does not carry message */
20: public BaseException() {
21: super ();
22: }
23:
24: /** Constructs BaseException object which not carry message */
25: public BaseException(String pMessage) {
26: super (pMessage);
27: }
28:
29: /** Constructs BaseException with message and cause */
30: public BaseException(String pMessage, Throwable pCause) {
31: super (pMessage, pCause);
32: }
33:
34: /** Constructs BaseException with cause */
35: public BaseException(Throwable pCause) {
36: super (pCause);
37: }
38:
39: /** Generates message with possible cause appended to it */
40: public String getMessage() {
41: return getMessageWithCause();
42: }
43:
44: /** Allows subclasses to access clean message without cause printed with it */
45: protected String getMessageWithoutCause() {
46: return super .getMessage();
47: }
48:
49: /** Allows subclasses to access message with cause printed with it */
50: protected String getMessageWithCause() {
51: String lMessage = super .getMessage();
52: if (getCause() != null) {
53: lMessage += "\r\nCaused by exception : "
54: + getCause().getClass().getName() + ": "
55: + getCause().getMessage();
56: }
57: return lMessage;
58: }
59: }
|