JDK-6799099 : All automatic regression tests that create Robot fail on X11
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P2
  • Affected Version: 7
  • OS: generic,linux,solaris
  • CPU: generic,x86,sparc
  • Submit Date: 2009-01-29
  • Updated Date: 2016-06-22
  • Resolved Date: 2009-07-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7
7 b60Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Any application that creates the java.awt.Robot instance fails with the current JDK 7 build with the fowllowing exception:

java.lang.IllegalArgumentException: button doesn't exist 12
	at java.awt.event.InputEvent.getMaskForButton(InputEvent.java:233)
	at java.awt.Robot.<init>(Robot.java:101)

Almost half of AWT automatic regression tests use the Robot (throught the test.java.awt.regtesthelpers.Util.createRobot() method), and therefore fail, making it impossible to run the automatic tests.

For instance, this is what the test/java/awt/Frame/DynamicLayout/DynamicLayout.java ends up with:

----------System.err:(17/972)----------
java.lang.IllegalArgumentException: button doesn't exist 12
	at java.awt.event.InputEvent.getMaskForButton(InputEvent.java:233)
	at java.awt.Robot.<init>(Robot.java:101)
	at test.java.awt.regtesthelpers.Util.createRobot(Util.java:85)
	at DynamicLayout.init(DynamicLayout.java:90)
	at DynamicLayout.main(DynamicLayout.java:165)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:623)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:713)

Platforms tested:

Ubuntu 8.10 i586/KDE 
Mandriva Linux 2009/Gnome 2.24

Comments
SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6799099.5
2009-05-22

EVALUATION The exception happens on an attempt to get some index from the array of mouse buttons masks. That call comes from the Robot class which tries to get masks for every button. InputEvent has the private int array (BUTTON_DOWN_MASK) containing these masks. Since it's an int array it may only contain up to 32 values (they are 1<<i numbers). Actually up to 31, since the last one is reserved. Moreover, there are about ten reserved values for SHIFT, META and others so we don't fit into 32 bit space with 24 buttons supported by standard X systems. One of the possible ways is to use masks for BUTTON1|2|3 but introduce a method to get mouse button states for extra buttons.
2009-01-29