ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows 10 Pro (10.0.17134 build 17134)
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The java.awt.Robot.delay() method calls Thread.sleep(), which has the potential of throwing an InterruptedException. If that exception occurs, Robot.delay() catches it and outputs the exception's stacktrace to the standard error stream. The JavaDoc does not mention anything about the stderr writes.
REGRESSION : Last worked in version 8u181
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
This problem occurs at random times. But it is possible to induce it by calling Robot.delay() and then having another thread interrupt the sleeping thread.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Since the JavaDoc does not mention stderr writes, I suggest that Robot.delay() capture and bury the exception. This is preferable to modifying Robot.delay() to throw the exception since that method redefinition would break existing code.
Robot.delay() outputs the InterruptedException stacktrace to the standard error stream.
---------- BEGIN SOURCE ----------
Robot robot = new Robot();
robot.mouseWheel(5); // see Workaround for explanation
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Note that Robot.delay() is used internally by other Robot methods. For instance, mouseWheel() -> afterEvent() -> autoDelay() -> delay(). This means that a programmer cannot alleviate this problem by simply using Thread.sleep() in place of Robot.delay().
However, the standard error stream can be redirected to prevent the user from seeing a sporadic exception message in the output console.
FREQUENCY : rarely