JDK-4923108 : ArrayIndexOutOfBoundsException in getDefaultScreenDevice with dual monitors
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1_03
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-09-16
  • Updated: 2003-09-17
  • Resolved: 2003-09-17
Related Reports
Duplicate :  
Description
This problem is seen only with dual-monitor systems running Windows XP with remote desktop enabled. It also happens on machines with two video cards, not
on machines that have a single video card that feeds two different monitors.
It happens under JDK 1.4.1_02, 1.4.1_03 and 1.4.2_01.


STEPS TO REPRODUCE:

- Choose any Swing/AWT application (like: SwingSet demo)

- Set the monitor on the right to be the primary display (normally the left 
  monitor is the primary).

- Log into the machine through remote desktop.

- Launch the application (any Swing app should cause the behavior as 
  well).

- Disconnect the remote desktop session, but do not log out - the app should
  remain running.

- Log in to the machine locally.

Most of the time the VM hits this exception:

java.lang.ArrayIndexOutOfBoundsException: 1
        at sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Win32GraphicsEnvironment.java:61)
        at sun.awt.windows.WToolkit.resetGC(WToolkit.java:126)
        at sun.awt.Win32GraphicsEnvironment.displayChanged(Win32GraphicsEnvironment.java:79)
        at sun.awt.windows.WToolkit$4.run(WToolkit.java:734)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.lang.ArrayIndexOutOfBoundsException: 1
        at sun.awt.windows.WWindowPeer.displayChanged(WWindowPeer.java:162)
        at sun.awt.windows.WWindowPeer$1.run(WWindowPeer.java:126)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.lang.ArrayIndexOutOfBoundsException: 1
        at sun.awt.windows.WWindowPeer.displayChanged(WWindowPeer.java:162)
        at sun.awt.windows.WWindowPeer$1.run(WWindowPeer.java:126)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Comments
EVALUATION This is reproducible as described. It can also be reproduced locally: * disable one of the screens * start up swingset * enabled the secondary screen * drag the SwingSet app to the second screen As far as the JDK is concerned, this is what happens in the remote case, too. When SwingSet is started on the remote machine, the GraphicsEnvironment only sees one screen. When the connection is closed, it's as if another screen was added. The problem is we're not correctly tracking the addition of secondary monitors. We may already have a bug for this. ###@###.### 2003-09-16 This is the same basic problem as 4417798. I'm closing this out as a duplicate. ###@###.### 2003-09-17
16-09-2003