6699328: NullPointerException in EventQueue.dispatchEvent when applet is closed, only reprise/scenario applet
authoridk
Fri, 25 Jul 2008 14:26:27 -0400
changeset 1294 16088ec1b9e7
parent 1293 ef349b440fc9
child 1295 3cf2264a5743
6699328: NullPointerException in EventQueue.dispatchEvent when applet is closed, only reprise/scenario applet Reviewed-by: bchristi
jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
jdk/src/share/classes/sun/awt/EventQueueDelegate.java
--- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java	Fri Jul 25 14:13:59 2008 -0400
+++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java	Fri Jul 25 14:26:27 2008 -0400
@@ -133,42 +133,46 @@
         }
 
         @Override
-        public void afterDispatch(AWTEvent event, Object handle) {
+        public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException {
             afterDispatchEventArgument[0] = event;
             afterDispatchHandleArgument[0] = handle;
             try {
                 afterDispatchCallable.call();
+            } catch (InterruptedException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw e;
             } catch (Exception e) {
-                if (e instanceof RuntimeException) {
-                    throw (RuntimeException) e;
-                }
+                throw new RuntimeException(e);
             }
         }
 
         @Override
-        public Object beforeDispatch(AWTEvent event) {
+        public Object beforeDispatch(AWTEvent event) throws InterruptedException {
             beforeDispatchEventArgument[0] = event;
             try {
                 return beforeDispatchCallable.call();
+            } catch (InterruptedException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw e;
             } catch (Exception e) {
-                if (e instanceof RuntimeException) {
-                    throw (RuntimeException) e;
-                }
+                throw new RuntimeException(e);
             }
-            return null;
         }
 
         @Override
-        public AWTEvent getNextEvent(EventQueue eventQueue) {
+        public AWTEvent getNextEvent(EventQueue eventQueue) throws InterruptedException {
             getNextEventEventQueueArgument[0] = eventQueue;
             try {
                 return getNextEventCallable.call();
+            } catch (InterruptedException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw e;
             } catch (Exception e) {
-                if (e instanceof RuntimeException) {
-                    throw (RuntimeException) e;
-                }
+                throw new RuntimeException(e);
             }
-            return null;
         }
     }
 }
--- a/jdk/src/share/classes/sun/awt/EventQueueDelegate.java	Fri Jul 25 14:13:59 2008 -0400
+++ b/jdk/src/share/classes/sun/awt/EventQueueDelegate.java	Fri Jul 25 14:26:27 2008 -0400
@@ -58,7 +58,7 @@
          * @param event  to be dispatched by {@code dispatch} 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.
@@ -66,6 +66,6 @@
          * @param event {@code event} dispatched by the {@code dispatch} 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;
     }
 }