JDK-6833404 : java.awt.event.MouseEvent constructor should mention throwing HE in headless mode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-04-23
  • Updated: 2012-03-22
  • Resolved: 2011-03-07
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 Availability Release.

To download the current JDK release, click here.
7 b60Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
For JDK7 the following code

public class Test {
    public static void main(String[] args) {
        new java.awt.event.MouseEvent(new javax.swing.JButton(), 0, 0, 0, 0,0,0,true, 0);

if executed with -Djava.awt.headless=true 

will throw something like:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at Test.main(Test.java:4)
Caused by: java.awt.HeadlessException
        at java.awt.MouseInfo.getNumberOfButtons(MouseInfo.java:122)
        at java.awt.event.MouseEvent.<clinit>(MouseEvent.java:420)
        ... 1 more

EVALUATION Current approach to 6799099 and 6834576 defects imposes that the MouseInfo.getNumberOfButtons() will be removed with some other internal API which doesn't require lock to perform.

EVALUATION Caused by 6315717.