Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4714232

RFE: replace sun.awt.exception.handler system property with official API

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 1.4.0, 5.0
    • client-libs
    • b49
    • generic, x86
    • generic, windows_2000

      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)
      ======================================================================

            art Artem Ananiev (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: