United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4714232 : RFE: replace sun.awt.exception.handler system property with official API

Details
Type:
Enhancement
Submit Date:
2002-07-12
Status:
Resolved
Updated Date:
2009-05-06
Project Name:
JDK
Resolved Date:
2009-05-06
Component:
client-libs
OS:
generic,windows_2000
Sub-Component:
java.awt
CPU:
x86,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0,5.0
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description
Name: jk109818			Date: 07/12/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

any OS

A DESCRIPTION OF THE PROBLEM :
java.awt.EventDispatchThread's default behaviour for
uncaught exceptions during event processing (dump a stack
trace to the console) is inappropriate for professional
level applications, since usually the system console is not
even visible to the user. Instead, the application should
record the exception in a logfile or present a dialog box to
the user.

Sun has thus taken a step in the right direction and
provided the system property "sun.awt.exception.handler" to
override the default exception handling behaviour of the
event dispatch thread.

However, this is not part of the official API. Quote from
the sourcecode:
This method is a temporary hack to work around the absence
of a real API that provides the ability to replace the
event-dispatch thread.  The magic
"sun.awt.exception.handler" property will be removed in a
future release.

I don't want to replace the event-dispatch thread, all I'm
asking for is some API that lets me install an exception
handler and that is guaranteed to work in future releases of
Java.

  



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
One solution would be to add a method

  public void setExceptionHandler(AWTExceptionHandler handler)

to EventDispatchThread, where AWTExceptionHandler is defined as follows:

  public interface AWTExceptionHandler
  {
    void handle(Throwable t);
  }
---------- END SOURCE ----------
(Review ID: 159187) 
======================================================================

                                    

Comments
EVALUATION

Expected to be fixed with 6727884. See 6727884 for evaluation and suggested fix.
                                     
2008-08-27



Hardware and Software, Engineered to Work Together