JDK-7117595 : ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7,7u1
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-12-02
  • Updated: 2014-10-15
  • Resolved: 2013-09-27
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.
JDK 8
8 b112Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
This bug report is related to bug #6358034.

When removing a secondary display I sometimes get the following exception in Swing applications:

java.lang.ArrayIndexOutOfBoundsException: 1
	at sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Win32GraphicsEnvironment.java:96)
	at sun.awt.windows.WWindowPeer.updateGC(WWindowPeer.java:468)
	at sun.awt.windows.WWindowPeer.displayChanged(WWindowPeer.java:506)
	at sun.awt.SunDisplayChanger.notifyListeners(SunDisplayChanger.java:132)
	at sun.awt.Win32GraphicsDevice.displayChanged(Win32GraphicsDevice.java:488)
	at sun.java2d.d3d.D3DGraphicsDevice.displayChanged(D3DGraphicsDevice.java:488)
	at sun.awt.Win32GraphicsEnvironment.displayChanged(Win32GraphicsEnvironment.java:184)
	at sun.awt.windows.WToolkit$3.run(WToolkit.java:758)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
	at java.awt.EventQueue.access$000(EventQueue.java:101)
	at java.awt.EventQueue$3.run(EventQueue.java:666)
	at java.awt.EventQueue$3.run(EventQueue.java:664)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Looking at the method in question, we're invoking the following code:

   getScreenDevices()[getDefaultScreen()]

It looks like the list of devices is changing between the time getScreenDevices() and getDefaultScreen() are invoked.


REPRODUCIBILITY :
This bug can be reproduced occasionally.

Comments
http://cr.openjdk.java.net/~malenkov/7117595.8.0/
23-09-2013