Thanks for the advice Mark, I fixed this up and committed it.
2005-11-08 Anthony Balkissoon <[EMAIL PROTECTED]>
* java/awt/event/InvocationEvent.java:
(exception): Removed unnecessary field.
(dispatch): Removed reference to field exception.
(getException): If throwable is an Exception, return a casted version,
otherwise return null.
(getThrowable): Improved docs.
--Tony
On Tue, 2005-11-08 at 19:22 +0100, Mark Wielaard wrote:
> Hi Tony,
>
> On Mon, 2005-11-07 at 13:29 -0500, Anthony Balkissoon wrote:
> > JAPI pointed out that InvocationEvent.getThrowable was missing. I wrote
> > it, which involved a slight tweak of dispatch() as well.
> > [...]
> > + /**
> > + * 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
> > + */
> > + public Throwable getThrowable()
> > + {
> > + return throwable;
> > + }
>
> Please add @since 1.5 to such new methods.
> Now we have both a throwable and a exception private field. Unless we
> need them for serialization it is probably better to collapse them into
> one and let getException() do an instanceof Exception.
>
> Cheers,
>
> Mark
> _______________________________________________
> Classpath-patches mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: java/awt/event/InvocationEvent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/event/InvocationEvent.java,v
retrieving revision 1.10
diff -u -r1.10 InvocationEvent.java
--- java/awt/event/InvocationEvent.java 7 Nov 2005 18:28:03 -0000 1.10
+++ java/awt/event/InvocationEvent.java 8 Nov 2005 20:49:01 -0000
@@ -98,16 +98,9 @@
protected boolean catchExceptions;
/**
- * This is the caught exception thrown in the <code>run()</code> method. It
- * is null if exceptions are ignored, the run method hasn't completed, or
- * there were no exceptions.
- *
- * @serial the caught exception, if any
- */
- 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;
@@ -191,8 +184,6 @@
catch (Throwable t)
{
throwable = t;
- if (t instanceof Exception)
- exception = (Exception)t;
}
else
runnable.run();
@@ -214,7 +205,9 @@
*/
public Exception getException()
{
- return exception;
+ if (throwable == null || !(throwable instanceof Exception))
+ return null;
+ return (Exception) throwable;
}
/**
@@ -222,6 +215,7 @@
* Null if none was thrown or if this InvocationEvent doesn't catch
* throwables.
* @return the caught Throwable
+ * @since 1.5
*/
public Throwable getThrowable()
{
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches