You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2006/12/21 14:07:39 UTC

svn commit: r489342 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/EventDispatchThread.java test/api/java/common/java/awt/EventDispatchThreadRTest.java

Author: apetrenko
Date: Thu Dec 21 05:07:38 2006
New Revision: 489342

URL: http://svn.apache.org/viewvc?view=rev&rev=489342
Log:
Patch for HARMONY-2818 "[classlib][awt] Wrong exception handling in java.awt.EventDispatchThread causes VM hangup"

Added:
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java   (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java?view=diff&rev=489342&r1=489341&r2=489342
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java Thu Dec 21 05:07:38 2006
@@ -46,16 +46,15 @@
 
         try {
             runModalLoop(null);
-        } catch (Exception e) {
-            e.printStackTrace();
+        } finally {
+            toolkit.shutdownWatchdog.forceShutdown();
         }
-
-        toolkit.shutdownWatchdog.forceShutdown();
     }
 
     void runModalLoop(ModalContext context) {
         long lastPaintTime = System.currentTimeMillis();
         while (!shutdownPending && (context == null || context.isModalLoopRunning())) {
+            try {
             EventQueue eventQueue = toolkit.getSystemEventQueueImpl();
 
             NativeEvent ne = nativeQueue.getNextEvent();
@@ -84,6 +83,9 @@
                     lastPaintTime = System.currentTimeMillis();
                     waitForAnyEvent();
                 }
+            }
+            } catch (Throwable t) {
+                t.printStackTrace();
             }
         }
     }

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java?view=auto&rev=489342
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java Thu Dec 21 05:07:38 2006
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package java.awt;
+
+import junit.framework.TestCase;
+
+/*
+ * Regression test for JIRA issue HARMONY-2818
+ */
+public class EventDispatchThreadRTest extends TestCase {
+    public final void testHARMONY2818() throws Throwable {
+        EventQueue.invokeLater(
+            new Runnable() {
+                public void run() {
+                    throw new RuntimeException("expected from EDT");
+                }
+            }
+        );
+        EventQueue.invokeAndWait(
+            new Runnable() {
+                public void run() {
+                }
+            }
+        );
+    }
+}
\ No newline at end of file

Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventDispatchThreadRTest.java
------------------------------------------------------------------------------
    svn:eol-style = native