-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.1.7
-
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)
======================================================================
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)
======================================================================
- relates to
-
JDK-4638447 AWT Debugging Support Enhancements (Java level)
-
- Closed
-