<AWT Dev> [12] Review Request: 8210231 Robot.delay() catches InterruptedException and prints stacktrace to stderr.

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Jul 9 18:01:06 UTC 2019

On 07/07/2019 16:51, Philip Race wrote:
2) However I am still worried by this change of behaviour. We have a sequence of Robot.delay() calls in a typical test and if one of them gets interrupted, then the next one will also return immediately .. since the status is already but right before it returns it will again reset the interrupt status and so the same happens to the next one :

Right, this is what I proposed if the thread was interrupted then all subsequent calls to delay will be skipped(before this fix only the first delay was skipped). So the test will ends immediately, or by some exception if it uses the methods like Thread.sleep(), EventQueue.invokeAndWait() etc.

- Consider this :- public class I { public static void main(String[] args) { Thread.currentThread().interrupt(); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } }
> java I
> java.lang.InterruptedException: sleep interrupted
>      at java.lang.Thread.sleep(Native Method)
>      at I.main(I.java:5)
> Are we to update all Robot tests to clear the interrupt status before calling delay ?
> Or should delay clear the status on entry to delay ?
> Or something else ?
My proposal is do not change any tests or code which use delay(), I guess it is not necessary.

Best regards, Sergey.

More information about the awt-dev mailing list