harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495713 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/EventQueueCore.java test/api/java/common/java/awt/EventQueueTest.java
Date Fri, 12 Jan 2007 19:59:23 GMT
Author: hindessm
Date: Fri Jan 12 11:59:22 2007
New Revision: 495713

URL: http://svn.apache.org/viewvc?view=rev&rev=495713
Log:
Applied patches from "[#HARMONY-2412] [classlib][awt]
j.a.EventQueue.getCurrentEvent() returns null inside invokeAndWait()".

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueCore.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueCore.java?view=diff&rev=495713&r1=495712&r2=495713
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueCore.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueCore.java
Fri Jan 12 11:59:22 2007
@@ -124,13 +124,21 @@
     
     synchronized void dispatchEvent(AWTEvent event) {
         updateCurrentEventAndTime(event);
-        activeQueue.dispatchEvent(event);
-        currentEvent = null;
+        try {
+            activeQueue.dispatchEvent(event);
+        } finally {
+            currentEvent = null;
+        }
     }
     
     void dispatchEventImpl(AWTEvent event) {
         if (event instanceof ActiveEvent) {
-            ((ActiveEvent) event).dispatch();
+            updateCurrentEventAndTime(event);
+            try {
+                ((ActiveEvent) event).dispatch();
+            } finally {
+                currentEvent = null;
+            }
             return;
         }
 

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventQueueTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventQueueTest.java?view=auto&rev=495713
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventQueueTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/EventQueueTest.java
Fri Jan 12 11:59:22 2007
@@ -0,0 +1,35 @@
+/*
+ *  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 java.awt.event.InvocationEvent;
+
+import junit.framework.TestCase;
+
+public class EventQueueTest extends TestCase {
+    private AWTEvent event;
+
+    public void testInvokeAndWait() throws Exception {
+        EventQueue.invokeAndWait(new Runnable() {
+            public void run() {
+                event = EventQueue.getCurrentEvent();
+            }
+        });
+        assertNotNull(event);
+        assertTrue(event instanceof InvocationEvent);
+    }
+}

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



Mime
View raw message