107 |
private Exception exception; |
private Exception exception; |
108 |
|
|
109 |
/** |
/** |
110 |
|
* This is the caught Throwable thrown in the <code>run()</code> method. |
111 |
|
* It is null if throwables are ignored, the run method hasn't completed, |
112 |
|
* or there were no throwables thrown. |
113 |
|
*/ |
114 |
|
private Throwable throwable; |
115 |
|
|
116 |
|
/** |
117 |
* The timestamp when this event was created. |
* The timestamp when this event was created. |
118 |
* |
* |
119 |
* @see #getWhen() |
* @see #getWhen() |
190 |
{ |
{ |
191 |
runnable.run(); |
runnable.run(); |
192 |
} |
} |
193 |
catch (Exception e) |
catch (Throwable t) |
194 |
{ |
{ |
195 |
exception = e; |
throwable = t; |
196 |
|
if (t instanceof Exception) |
197 |
|
exception = (Exception)t; |
198 |
} |
} |
199 |
else |
else |
200 |
runnable.run(); |
runnable.run(); |
220 |
} |
} |
221 |
|
|
222 |
/** |
/** |
223 |
|
* Returns a throwable caught while executing the Runnable's run() method. |
224 |
|
* Null if none was thrown or if this InvocationEvent doesn't catch |
225 |
|
* throwables. |
226 |
|
* @return the caught Throwable |
227 |
|
* @since 1.5 |
228 |
|
*/ |
229 |
|
public Throwable getThrowable() |
230 |
|
{ |
231 |
|
return throwable; |
232 |
|
} |
233 |
|
|
234 |
|
/** |
235 |
* Gets the timestamp of when this event was created. |
* Gets the timestamp of when this event was created. |
236 |
* |
* |
237 |
* @return the timestamp of this event |
* @return the timestamp of this event |