ExecutionException.java |
1 /* 2 * ExecutionException.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, June 1991 (in the distribution as file licence.html, 9 * and also available at http://gate.ac.uk/gate/licence.html). 10 * 11 * Hamish Cunningham, 23/Oct/2000 12 * 13 * $Id: ExecutionException.java,v 1.9 2005/01/11 13:51:31 ian Exp $ 14 */ 15 16 package gate.creole; 17 18 import gate.util.GateException; 19 20 /** This exception indicates failure during <CODE>run()</CODE> 21 * invocations on ProcessingResources. 22 * These cannot be thrown at run time because <CODE>run()</CODE> 23 * is inheritted from <CODE>runnable</CODE> and doesn't throw anything. 24 */ 25 public class ExecutionException extends GateException { 26 /** Debug flag */ 27 private static final boolean DEBUG = false; 28 29 public ExecutionException() { 30 super(); 31 } 32 33 public ExecutionException(String s) { 34 super(s); 35 } 36 37 public ExecutionException(Exception e) { 38 this.exception = e; 39 } 40 41 /** 42 * Overriden so we can print the enclosed exception's stacktrace too. 43 */ 44 public void printStackTrace(){ 45 printStackTrace(System.err); 46 } 47 48 /** 49 * Overriden so we can print the enclosed exception's stacktrace too. 50 */ 51 public void printStackTrace(java.io.PrintStream s) { 52 s.flush(); 53 super.printStackTrace(s); 54 s.print(" Caused by:\n"); 55 if(exception != null) exception.printStackTrace(s); 56 } 57 58 /** 59 * Overriden so we can print the enclosed exception's stacktrace too. 60 */ 61 public void printStackTrace(java.io.PrintWriter s) { 62 s.flush(); 63 super.printStackTrace(s); 64 s.print(" Caused by:\n"); 65 if(exception != null) exception.printStackTrace(s); 66 } 67 68 Exception exception; 69 } // ExecutionException 70