| GateRuntimeException.java |
1 /*
2 * GateRuntimeException.java
3 *
4 * Copyright (c) 1998-2004, The University of Sheffield.
5 *
6 * This file is part of GATE (see http://gate.ac.uk/), and is free
7 * software, licenced under the GNU Library General Public License,
8 * Version 2, June1991.
9 *
10 * A copy of this licence is included in the distribution in the file
11 * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12 *
13 * Valentin Tablan, 03/11/2000
14 *
15 * $Id: GateRuntimeException.java,v 1.4 2004/07/21 17:10:09 akshay Exp $
16 */
17 package gate.util;
18
19 /**
20 * Exception used to signal a runtime exception within Gate.
21 */
22 public class GateRuntimeException extends RuntimeException {
23
24 public GateRuntimeException() {
25 }
26
27 public GateRuntimeException(String message) {
28 super(message);
29 }
30
31 public GateRuntimeException(Exception e) {
32 this.exception = e;
33 }
34
35 /**
36 * Overriden so we can print the enclosed exception's stacktrace too.
37 */
38 public void printStackTrace(){
39 printStackTrace(System.err);
40 }
41
42 /**
43 * Overriden so we can print the enclosed exception's stacktrace too.
44 */
45 public void printStackTrace(java.io.PrintStream s) {
46 s.flush();
47 super.printStackTrace(s);
48 s.print(" Caused by:\n");
49 if(exception != null) exception.printStackTrace(s);
50 }
51
52 /**
53 * Overriden so we can print the enclosed exception's stacktrace too.
54 */
55 public void printStackTrace(java.io.PrintWriter s) {
56 s.flush();
57 super.printStackTrace(s);
58 s.print(" Caused by:\n");
59 if(exception != null) exception.printStackTrace(s);
60 }
61
62
63 Exception exception;
64 }