Out of Bounds Exception (DockingFrames)

Can anyone help me with this error? It does not happen all the time, only once every few runs.

[Thu, 5 Sep 2013 10:46:36.836] Exception in thread “AWT-EventQueue-0”
[Thu, 5 Sep 2013 10:46:36.858] java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
[Thu, 5 Sep 2013 10:46:36.862] at java.util.ArrayList.RangeCheck(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.866] at java.util.ArrayList.get(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.870] at bibliothek.gui.dock.themes.basic.action.buttons.ButtonPanel.getItemsOrdered(ButtonPanel.java:404)
[Thu, 5 Sep 2013 10:46:36.873] at bibliothek.gui.dock.themes.basic.action.buttons.ButtonPanel.getPreferredSizes(ButtonPanel.java:450)
[Thu, 5 Sep 2013 10:46:36.875] at bibliothek.gui.dock.station.stack.DockActionCombinedInfoComponent.getSizes(DockActionCombinedInfoComponent.java:177)
[Thu, 5 Sep 2013 10:46:36.876] at bibliothek.gui.dock.station.stack.tab.MenuLineLayoutPane.listLayouts(MenuLineLayoutPane.java:260)
[Thu, 5 Sep 2013 10:46:36.878] at bibliothek.gui.dock.station.stack.tab.MenuLineLayoutPane.layout(MenuLineLayoutPane.java:205)
[Thu, 5 Sep 2013 10:46:36.878] at bibliothek.gui.dock.station.stack.tab.MenuLineLayout.layout(MenuLineLayout.java:123)
[Thu, 5 Sep 2013 10:46:36.879] at bibliothek.gui.dock.station.stack.tab.AbstractTabPane.doLayout(AbstractTabPane.java:129)
[Thu, 5 Sep 2013 10:46:36.880] at bibliothek.gui.dock.station.stack.CombinedStackDockContentPane.doLayout(CombinedStackDockContentPane.java:102)
[Thu, 5 Sep 2013 10:46:36.881] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.881] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.882] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.882] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.883] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.883] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.884] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.884] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.885] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.885] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.886] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.886] at java.awt.Container.validateTree(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.887] at java.awt.Container.validate(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.887] at javax.swing.RepaintManager$2.run(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.890] at javax.swing.RepaintManager$2.run(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.890] at java.security.AccessController.doPrivileged(Native Method)
[Thu, 5 Sep 2013 10:46:36.892] at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.900] at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source)
[Thu, 5 Sep 2013 10:46:36.901] at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)

Hi,

you are trying to access an array at position 0 (first position) where there is no item in that array.

Please post your code, to help further.

Best regards

Martin

The Exception says, that the Array has the size 0
How do u determine the Array size?

He is using my library, and likely knows what an IndexOutOfBoundsException is (otherwise he would not be able to use the library - as it is not meant for beginners). :wink:

„Only once every few turns“ is a good indication of a multi-threading issue. Are you building or changing the UI from another thread than the EDT (EventDispatchThread)? Probably from within the „main(String…args)“ method? DockingFrames does not support multi-threading.

I have run into the same error using docking frames 1.1.1:
13:56:13.730 Normal AWT-EventQueue-0 Info Exception in thread “AWT-EventQueue-0” java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at java.util.ArrayList.rangeCheck(Unknown Source) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at java.util.ArrayList.get(Unknown Source) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.themes.basic.action.buttons.ButtonPanel.getItemsOrdered(ButtonPanel.java:404) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.themes.basic.action.buttons.ButtonPanel.getPreferredSizes(ButtonPanel.java:450) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.DockActionCombinedInfoComponent.getSizes(DockActionCombinedInfoComponent.java:169) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.tab.MenuLineLayoutPane.listLayouts(MenuLineLayoutPane.java:250) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.tab.MenuLineLayoutPane.getPreferredSize(MenuLineLayoutPane.java:93) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.tab.MenuLineLayout.getPreferredSize(MenuLineLayout.java:108) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.tab.AbstractTabPane.getPreferredSize(AbstractTabPane.java:155) - Category: com.sophion.general.baseui.Log$4; ;
13:56:13.730 Normal AWT-EventQueue-0 Info at bibliothek.gui.dock.station.stack.CombinedStackDockContentPane.getPreferredSize(CombinedStackDockContentPane.java:107) - Category: com.sophion.general.baseui.Log$4; ;

This error is followed by a never ending series of nullpointerexceptions from the swing library, so the application is completely blocked by this. None of our own code is in the stacktraces.
Our application is more than 200000 lines of code, so I cannot post all of it. However I have no idea which part of the code is causing this. Is there any way to get a clue on which panel is causing this?

no code … no help :wink:

regards
Klaus

Well, no code, some hint, at least: As Beni already mentioned, the behavior that was described by the original poster seemed likely to be caused by a threading issue. Particularly, ALL GUI-related operations should be done on the Event Dispatch Thread.

Do you have any additional Threads in your application that might do anything that is related to GUI components?
Does the error occur reproducably under certain condtions or after a certain action (if so, what is this condition or action?) Or does it happen seemingly randomly?

Before doing anything: update 1.1.1 to 1.1.2p10e, because 1.1.1 is over two years old, while 1.1.2p10e is only two weeks old. There is a chance that this bug will disappear with a newer version.

download page

Thanks for the info. We are aware that all UI changes should happen from the AWT-EventQueue thread and we always follow that.
One issue that seems strange, is that the code fails accessing the item at index 0 at a ButtonPanel as if a button has been removed. We do not remove any buttons in our code. When we have added a button, it stays there.
You say “no code … no help”. But what if we sent you 200000 lines of code that has to be run on three PCs distributed and told you to look for a bug that has only happened two times and only when connected to our machine. I guess we would not get any help either.
I would like to narrow down the problem and create a simple subset of the code, that I could post, but that would require that I had any idea of where (which panel) the problem occurs in. But none of the lines in the stacktrace is from our code…
But I will try 1.1.2p10e and see if that helps.

Please tell me the result of the update. I’ll do some investigating if you still see this exception. The framework is not without bugs, but some of them are hard to find…

And don’t listen to vfl_freak :wink: : this forum provides help for complex frameworks like JCUDA and DockingFrames, and at the same time is open for absolute beginners. Sometimes people do not realize that they have left the beginners section and are answering in the advanced section.
Of course I never say no to a test that reproduces an issue - but let’s first try the (hopefully) easy way of doing an update.

I think „AWT-EventQueue-0“ in the OP (first line actually) answers some of the questions raised here… :wink:

I’m not sure whether this is what you are refering to, but the Event Dispatch Thread is where the error happens - this is not necessarily the same Thread that caused the error. But of course, until now, we’re actually just guessing what might cause the error. Maybe we’ll be informed about whether the update fixed this issue eventually.