From 41e1a7d836f33de5d79317546fdd718e3e789d8f Mon Sep 17 00:00:00 2001 From: Nelson Tavares de Sousa <ntd@informatik.uni-kiel.de> Date: Mon, 26 Jan 2015 17:02:18 +0100 Subject: [PATCH] enhanched classes --- .../teetime/framework/StageException.java | 8 ++++++- .../framework/StageExceptionListener.java | 23 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/main/java/teetime/framework/StageException.java b/src/main/java/teetime/framework/StageException.java index c1a6a8da..3f6c2b25 100644 --- a/src/main/java/teetime/framework/StageException.java +++ b/src/main/java/teetime/framework/StageException.java @@ -12,12 +12,18 @@ public class StageException extends Exception { private static final long serialVersionUID = 6724637605943897808L; private final Stage throwingStage; + private final Exception originalException; - public StageException(final Stage throwingStage) { + public StageException(final Exception e, final Stage throwingStage) { super(); + this.originalException = e; this.throwingStage = throwingStage; } + public Exception getOriginalException() { + return originalException; + } + /** * Returns the stage, which failed with an uncatched exception * diff --git a/src/main/java/teetime/framework/StageExceptionListener.java b/src/main/java/teetime/framework/StageExceptionListener.java index 7f149c16..5d43088d 100644 --- a/src/main/java/teetime/framework/StageExceptionListener.java +++ b/src/main/java/teetime/framework/StageExceptionListener.java @@ -1,5 +1,9 @@ package teetime.framework; +/** + * Represent a minimalistic StageExceptionListener. Listener which extend from this one, must a least implement this functionality. + * + */ public abstract class StageExceptionListener { private final Thread thread; @@ -8,6 +12,23 @@ public abstract class StageExceptionListener { this.thread = thread; } - public abstract void onStageException(Stage throwingStage); + /** + * This method will be executed if an exception arises. + * + * @param e + * thrown exception + * @param throwingStage + * the stage, which has thrown the exception. + */ + public abstract void onStageException(Exception e, Stage throwingStage); + + /** + * Retrieves the thread in which the exception occurred. + * + * @return exception throwing thread + */ + public Thread getThread() { + return thread; + } } -- GitLab