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

No way to redirect AWT squawking from System.err to some other place

    • Fix Understood
    • generic
    • generic

      Name: krT82822 Date: 03/12/99


      There are places in the AWT code that catch an error
      and print it to System.err, usually with a prefix such as:
      "Exception occurred during event dispatching:". Some exceptions
      are due to code that is beyond normal developer control (such
      as bugs in Swing), and sometimes it's useful to be able to
      differentiate AWT-generated squawking from other parts of the
      system. It would be nice if there were a standard method to
      call on an AWT toolkit to give it an alternate destination for
      its complaints. Merely specifying a different stream would be
      adequate, but ideally, there would be a mechanism for directly
      communicating exceptions in their original form (not
      printStackTrace()d).

      Here's an example of what it might look like:

      public interface ErrorSink
      {
          /** Send a simple string message to the error sink. */
          public error (String message);

          /** Send a throwable to the error sink. */
          public error (Throwable throwable);
      }

      public class java.awt.Toolkit
      {
          ...

          /** Set the error sink for this toolkit. */
          public void setErrorSink (ErrorSink sink);
      }

      Every place in AWT that currently refers to System.err (directly
      or implicitly, by using printStackTrace()) would change to refer
      to the error sink for the toolkit. The default error sink of
      the toolkit would simply be one which printed everything to
      System.err, providing the same behavior as before until a
      call to setErrorSink() happened.

      Dan Bornstein
      ###@###.###
      (Review ID: 55269)
      ======================================================================

            Unassigned Unassigned
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: