-
Bug
-
Resolution: Fixed
-
P2
-
1.1.6, 1.2.1
-
beta
-
generic, x86
-
generic, windows_95
Name: dbT83986 Date: 04/18/99
PROBLEM: When calling SwingUtilities.invokeAndWait, and the
Runnable's run method throws an exception, the exception is caught
and ignored. The calling method never knows that an exception
was thrown. Since the caller detects no error, it may continue
running with invalid data, causing later crashes or data
problems that are difficult to track down.
CAUSE: invokeAndWait calls SystemEventQueueUtilities.postRunnable
(SwingUtilities.java line 1148), which returns an object of
type Exception, then calls lock.wait. The exception object
returned by postRunnable is always null, because postRunnable
returns before the other thread has executed. Any exception
thrown by the Runnable is caught by processRunnableEvent and
stored into a location where it is silently discarded due to
this bug.
SOLUTION: Move the lock.wait call from invokeAndWait into
postRunnable. At SystemEventQueueUtilities.java line 282,
just before the return statement, add a call to lock.wait()
(with necessary boilerplate) if lock!=null.
This bug was introduced in Swing-1.0.2 (perhaps in 1.0.1) with
the introduction of the SystemEventQueueUtilities class. The
invokeAndWait call properly catches and returns exception in
Swing-1.0.
(Review ID: 57035)
======================================================================
- duplicates
-
JDK-4145854 SwingUtilities.invokeAndWait not throwing InvocationTargetException
-
- Closed
-