java.lang.ArrayIndexOutOfBoundsException when zooming in Swing Client

Description

Quite annoying bug that's been around for a while.

The following exception occurs when trying to zoom in some windows:

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.set(Unknown Source)
at org.compiere.apps.AEnv.removeWindow(AEnv.java:1092)
at org.compiere.apps.AMenu.onClearWindowContext(AMenu.java:842)
at org.compiere.util.Env.clearWinContext(Env.java:1302)
at org.compiere.util.Env.clearWinContext(Env.java:1537)
at org.compiere.model.MZoomCondition.findZoomWindowByWindowId(MZoomCondition.java:181)
at org.compiere.grid.ed.VLookup.actionZoom(VLookup.java:1489)
at org.compiere.grid.ed.VLookup.actionPerformed(VLookup.java:831)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Environment

None

Activity

Show:
Thomas Bayen
December 29, 2013, 12:12 PM

Can you give an easy garden world example how to reproduce this?

Daniel Tamm
December 29, 2013, 12:24 PM

I'll see what I can do.

The patch is really simple though and completely logical.

See
https://bitbucket.org/dantam/idempiere.se/commits/5577ddb605964d4a01abb369dfd820fd946362f1

For some reason a "removeWindow" call is made with the constant -1 and an array can never have an index of -1.

Daniel Tamm
December 29, 2013, 12:32 PM

The Garden World instance is so empty that there's nothing to test on unless data is entered.

In my environment I tried to zoom to an invoice line or purchase order line from the Matched Purchase Order window. It happens all over the place, but my general impression is that the problem occurs when trying to zoom to a "line" as opposed to the main tab "document".

Thomas Bayen
December 29, 2013, 12:37 PM

I did not know that you already had a patch. It may be this is a duplicate of IDEMPIERE-1610. This was on my list too for a long time but I never took the time for it. Thanks! I will review it.

Daniel Tamm
December 29, 2013, 12:56 PM

Sounds like a duplicate to me. I always try to search for duplicates before submitting, but since the same bug can be described in many ways, these kind of duplicates are sometimes hard to find
Thanks for reviewing!

Assignee

Daniel Tamm

Reporter

Daniel Tamm

Labels

Tested By

None

Time tracking

1h

Components

Affects versions

Priority

Major
Configure