1   /*
2    * GateRuntimeException.java
3    *
4    * Copyright (c) 1998-2005, 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.6 2005/01/11 13:51:37 ian 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(String message, Throwable cause) {
32      super(message);
33      this.throwable = cause;
34    }
35    
36    public GateRuntimeException(Throwable e) {
37      this.throwable = e;
38    }
39  
40    /**
41     * Overriden so we can print the enclosed exception's stacktrace too.
42     */
43    public void printStackTrace(){
44      printStackTrace(System.err);
45    }
46  
47    /**
48     * Overriden so we can print the enclosed exception's stacktrace too.
49     */
50    public void printStackTrace(java.io.PrintStream s) {
51      s.flush();
52      super.printStackTrace(s);
53      s.print("  Caused by:\n");
54      if(throwable != null) throwable.printStackTrace(s);
55    }
56  
57    /**
58     * Overriden so we can print the enclosed exception's stacktrace too.
59     */
60    public void printStackTrace(java.io.PrintWriter s) {
61      s.flush();
62      super.printStackTrace(s);
63      s.print("  Caused by:\n");
64      if(throwable != null) throwable.printStackTrace(s);
65    }
66    
67    
68    Throwable throwable;  
69  }