JDK-4896878 : java.beans.EventHandler smothers exceptions
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-07-26
  • Updated: 2003-08-04
  • Resolved: 2003-08-04
Related Reports
Duplicate :  
Description

Name: rl43681			Date: 07/26/2003


A DESCRIPTION OF THE REQUEST :
example the code in EventHandler.invoke.
It simply prints stack traces and returns null.

JUSTIFICATION :
1) This defeats any exception handling mechanisms with a more global context; a ThreadGroup handler, AWT EventDispatchThread handler, or simply a try/catch block already on the stack.  This makes a very useful class unusable for production code.

2) It violates Java best practices on exception handling



EXPECTED VERSUS ACTUAL BEHAVIOR :
It should simply rethrow unchecked exceptions and wrap any checked exceptions in an RTE wrapper.

<pre>
try {
   ....
} catch (RuntimeException rte) {
    throw rte;
} catch (InvocationTargetException ex) {
    throw new RuntimeException(getTargetException());
} catch (Throwable t) {
    throw new RuntimeException(t);
}
</pre>
Exception thrown by application code is smothered and simply printed on stdout.

---------- BEGIN SOURCE ----------
This is a no-brainer issue.
If you really need an example drop me a mail note.

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
subclass EventHandler properly implementing invoke and use that class instead :(
(Incident Review ID: 183039) 
======================================================================

Comments
EVALUATION duplicate of 4889282. ###@###.### 2003-08-04
04-08-2003