JDK-7021700 : Solaris11 x64/x86, java.awt.Robot generates duplicated key events.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris_nevada
  • CPU: x86
  • Submitted: 2011-02-23
  • Updated: 2011-03-11
  • Resolved: 2011-03-11
Related Reports
Relates :  
Description
This problem occurs only on Solaris 11 x64/x86. Solaris 11 sparc is not tested. When using java.awt.Robot to generate key event, the key is generated twice. jdk7 and 6ur (6u23, 6u25) have the same behavior. Other platforms don't have the issue.

Steps to follow to reproduce the problem:
Compile and run attached program TestRobot.java

******
import java.awt.event.KeyEvent;
import java.awt.Robot;
import java.awt.AWTException;

public class TestRobot {

    public static Robot robot = null;

    public static void initRobot() throws AWTException {
        if(robot == null) {
            robot = new Robot();
            robot.setAutoDelay(500);
        }
    }

    public static void main(String args[]) {
       try {
                initRobot();
            } catch (AWTException e) {
                e.printStackTrace();
            }

        robot.delay(2000);
        robot.keyPress(KeyEvent.VK_A);
        robot.keyRelease(KeyEvent.VK_A);
    }
}

******

BUG:
The sequence keyPress-keyRelease should just generate character 'a' once. This works fine on platforms other than Solaris11. But on Solaris 11, 'a' is generated twice.

Because of this behavior, on Solaris 11, the automation testing using java.awt.Robot will be impacted.

Comments
EVALUATION It seems that the problem could be concerned with key repeat delay settings. I tried to disable GNOME key repeat settings but it does not influence on behaviour. Could the submitter try to reproduce the problem with disabled key repeat on XKB, X11 level? Please let me know about results.
04-03-2011

EVALUATION I reproduced the issue see comments.
25-02-2011