[PATCH] java.awt.EventQueue : getNextEvent

Dalibor Topic kaffe@rufus.w3.org
Wed, 13 Mar 2002 15:46:33 +0100



--------------Boundary-00=_LD2XPYPYDND4IPP35FSH
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

this small patch changes the behavior of getNextEvent in
java.awt.EventQueue. Instead of silently swallowing all
InterruptedExceptions, it now lets them propagate up.

Reasoning: The API specification says that getNextEvent throws an
InterruptedException.

Dalibor Topic



--------------Boundary-00=_LD2XPYPYDND4IPP35FSH
Content-Type: text/plain;
  charset="us-ascii";
  name="ChangeLog"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="ChangeLog"

	* libraries/javalib/java/awt/EventQueue.java:
	(getNextEvent) Now throws InterruptedException. Try/catch
	statements for InterruptedException removed.

--------------Boundary-00=_LD2XPYPYDND4IPP35FSH
Content-Type: text/x-diff;
  charset="us-ascii";
  name="patch.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="patch.diff"

diff -urB kaffe/libraries/javalib/java/awt/EventQueue.java patched-kaffe/libraries/javalib/java/awt/EventQueue.java
--- kaffe/libraries/javalib/java/awt/EventQueue.java	Tue Oct 12 04:29:39 1999
+++ patched-kaffe/libraries/javalib/java/awt/EventQueue.java	Tue Mar 12 12:29:04 2002
@@ -127,7 +127,7 @@
 	}
 }
 
-public AWTEvent getNextEvent () {
+public AWTEvent getNextEvent () throws InterruptedException {
 	AWTEvent e;
 
 	if ( (Toolkit.flags & Toolkit.NATIVE_DISPATCHER_LOOP) != 0 ) {
@@ -137,9 +137,7 @@
 		synchronized ( this) {
 			// block until we get something in
 			while ( localQueue == null ) {
-				try {
-					wait();
-				} catch ( InterruptedException xx ) {}
+				wait();
 			}
 
 			e = localQueue;
@@ -181,9 +179,7 @@
 			// this point only in case it is not blocked, or evtGetNextEvent()
 			// returned 'null'
 			if ( !AWTEvent.accelHint ) {
-				try {
-					Thread.sleep( Defaults.EventPollingRate);
-				} catch ( InterruptedException xx ) {}
+				Thread.sleep( Defaults.EventPollingRate);
 			}
 		}
 	}

--------------Boundary-00=_LD2XPYPYDND4IPP35FSH--



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com