6699328: NullPointerException in EventQueue.dispatchEvent when applet is closed, only reprise/scenario applet

Reviewed-by: bchristi
This commit is contained in:
Igor Kushnirskiy 2008-07-25 14:26:27 -04:00
parent b4ae1216b3
commit 1dce4ceddd
2 changed files with 20 additions and 16 deletions

View File

@ -133,42 +133,46 @@ public class SwingUtilities3 {
} }
@Override @Override
public void afterDispatch(AWTEvent event, Object handle) { public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException {
afterDispatchEventArgument[0] = event; afterDispatchEventArgument[0] = event;
afterDispatchHandleArgument[0] = handle; afterDispatchHandleArgument[0] = handle;
try { try {
afterDispatchCallable.call(); afterDispatchCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof RuntimeException) { throw new RuntimeException(e);
throw (RuntimeException) e;
}
} }
} }
@Override @Override
public Object beforeDispatch(AWTEvent event) { public Object beforeDispatch(AWTEvent event) throws InterruptedException {
beforeDispatchEventArgument[0] = event; beforeDispatchEventArgument[0] = event;
try { try {
return beforeDispatchCallable.call(); return beforeDispatchCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof RuntimeException) { throw new RuntimeException(e);
throw (RuntimeException) e;
}
} }
return null;
} }
@Override @Override
public AWTEvent getNextEvent(EventQueue eventQueue) { public AWTEvent getNextEvent(EventQueue eventQueue) throws InterruptedException {
getNextEventEventQueueArgument[0] = eventQueue; getNextEventEventQueueArgument[0] = eventQueue;
try { try {
return getNextEventCallable.call(); return getNextEventCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
if (e instanceof RuntimeException) { throw new RuntimeException(e);
throw (RuntimeException) e;
}
} }
return null;
} }
} }
} }

View File

@ -58,7 +58,7 @@ public class EventQueueDelegate {
* @param event to be dispatched by {@code dispatch} method * @param event to be dispatched by {@code dispatch} method
* @return handle to be passed to {@code afterDispatch} method * @return handle to be passed to {@code afterDispatch} method
*/ */
public Object beforeDispatch(AWTEvent event); public Object beforeDispatch(AWTEvent event) throws InterruptedException;
/** /**
* Notifies delegate after EventQueue.dispatch method. * Notifies delegate after EventQueue.dispatch method.
@ -66,6 +66,6 @@ public class EventQueueDelegate {
* @param event {@code event} dispatched by the {@code dispatch} method * @param event {@code event} dispatched by the {@code dispatch} method
* @param handle object which came from {@code beforeDispatch} method * @param handle object which came from {@code beforeDispatch} method
*/ */
public void afterDispatch(AWTEvent event, Object handle); public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException;
} }
} }