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 BaseRuntimeException extends
19: java.lang.RuntimeException {
20: private Throwable mCause = null;
21:
22: /** Constructs BaseRuntimeException object which does not carry message */
23: public BaseRuntimeException() {
24: super ();
25: }
26:
27: /** Constructs BaseRuntimeException object which not carry message */
28: public BaseRuntimeException(String pMessage) {
29: super (pMessage);
30: }
31:
32: /** Constructs BaseRuntimeException with message and cause */
33: public BaseRuntimeException(String pMessage, Throwable pCause) {
34: super (pMessage);
35: mCause = pCause;
36: }
37:
38: /** Constructs BaseRuntimeException with cause */
39: public BaseRuntimeException(Throwable pCause) {
40: mCause = pCause;
41: }
42:
43: /** Returns cause exception or null if there is none */
44: public Throwable getCause() {
45: return mCause;
46: }
47:
48: public String getMessage() {
49: String lMessage = super .getMessage();
50: if (mCause != null) {
51: lMessage += "\r\nCaused by exception : "
52: + mCause.getClass().getName() + ": "
53: + mCause.getMessage();
54: }
55: return lMessage;
56: }
57: }
|