1.1.0p7b: java.lang.IndexOutOfBoundsException: null

Once again, I found an Exception.

java.lang.IndexOutOfBoundsException: null
	at bibliothek.gui.dock.station.support.PlaceholderList$SubList.addPlaceholder(PlaceholderList.java:1532) ~[dockingFramesCore.jar:na]
	at bibliothek.gui.dock.FlapDockStation.getDockableProperty(FlapDockStation.java:1552) ~[dockingFramesCore.jar:na]
	at bibliothek.gui.dock.util.DockUtilities.getPropertyChain(DockUtilities.java:357) ~[dockingFramesCore.jar:na]
	at bibliothek.gui.dock.common.mode.station.CFlapDockStationHandle.getCLocation(CFlapDockStationHandle.java:72) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.mode.CMinimizedMode.getCLocation(CMinimizedMode.java:59) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.mode.CLocationModeManager.getLocation(CLocationModeManager.java:323) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.intern.AbstractCDockable.getBaseLocation(AbstractCDockable.java:330) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.intern.CDockableLocationListenerManager.checkNow(CDockableLocationListenerManager.java:107) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.intern.CDockableLocationListenerManager.access$200(CDockableLocationListenerManager.java:46) ~[dockingFramesCommon.jar:na]
	at bibliothek.gui.dock.common.intern.CDockableLocationListenerManager$2.run(CDockableLocationListenerManager.java:99) ~[dockingFramesCommon.jar:na]
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) ~[na:1.6.0_22]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) ~[na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) [na:1.6.0_22]
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) [na:1.6.0_22]

I first minimized, then save —writeXML-----readXML—load into Exception.

complex layout----save —writeXML-----readXML—load into Exception.

2011-03-23 13:26:09.437 [AWT-EventQueue-0] ERROR c.mt.common.gui.EDTExceptionHandler - ????????????????
java.lang.NullPointerException: null
	at bibliothek.gui.dock.dockable.DockableStateListenerManager.fireNow(DockableStateListenerManager.java:231) ~[dockingFramesCore.jar:na]
	at bibliothek.gui.dock.dockable.DockableStateListenerManager.access$600(DockableStateListenerManager.java:50) ~[dockingFramesCore.jar:na]
	at bibliothek.gui.dock.dockable.DockableStateListenerManager$4.run(DockableStateListenerManager.java:216) ~[dockingFramesCore.jar:na]
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) ~[na:1.6.0_22]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) ~[na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) [na:1.6.0_22]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) [na:1.6.0_22]
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) [na:1.6.0_22]

I have to go to work now, I had only a small look at the issues and I can give only a small answer.

The second exception does not make any sense: this exception can only happen if there is a null in the list of DockableStateListener. However, there are safeguards against this. The only reason I could think of the exception is concurrent modification, so my question:

  • Does this exception happen all the time? Or does it happen randomly?
  • Does your application add or remove listeners in a thread that is not the EventDispatchThread?

The first exception could be explained and reproduced by concurrent modification as well. Try loading the layout in the EventDispatchThread (SwingUtilities.invokeLater/invokeAndWait), I am quite sure you would not have the exception.

In any way I’ll see if I can make this part of the framework a bit more resistent agains multi threading.

My Problem?I changed the code:

if(SwingUtilities.isEventDispatchThread()){
                        launchMainFrame(lp,pView);
                    }else{
                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                launchMainFrame(lp,pView);
                            }
                        });
                    }

This Exception do not exist.
About EDT security, in fact, I was very careful, but there are omissions
Thanks.