diff options
Diffstat (limited to 'libjava/classpath/java/awt/event/InvocationEvent.java')
-rw-r--r-- | libjava/classpath/java/awt/event/InvocationEvent.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libjava/classpath/java/awt/event/InvocationEvent.java b/libjava/classpath/java/awt/event/InvocationEvent.java index 75feb62bd94..6f39d6b9130 100644 --- a/libjava/classpath/java/awt/event/InvocationEvent.java +++ b/libjava/classpath/java/awt/event/InvocationEvent.java @@ -107,6 +107,13 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent private Exception exception; /** + * This is the caught Throwable thrown in the <code>run()</code> method. + * It is null if throwables are ignored, the run method hasn't completed, + * or there were no throwables thrown. + */ + private Throwable throwable; + + /** * The timestamp when this event was created. * * @see #getWhen() @@ -183,9 +190,11 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent { runnable.run(); } - catch (Exception e) + catch (Throwable t) { - exception = e; + throwable = t; + if (t instanceof Exception) + exception = (Exception)t; } else runnable.run(); @@ -211,6 +220,18 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent } /** + * Returns a throwable caught while executing the Runnable's run() method. + * Null if none was thrown or if this InvocationEvent doesn't catch + * throwables. + * @return the caught Throwable + * @since 1.5 + */ + public Throwable getThrowable() + { + return throwable; + } + + /** * Gets the timestamp of when this event was created. * * @return the timestamp of this event |