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


        * libraries/javalib/java/awt/EventQueue.java:
        (getNextEvent) Now throws InterruptedException. Try/catch
        statements for InterruptedException removed.
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);
 			}
 		}
 	}

Reply via email to