You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/01/12 20:59:23 UTC
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
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