Null pointer exception when resizing a dockable

Hi everyone,

I use docking frames in my application.
I have several Dockables in a CGrid (basically two columns) and I want the ones on the left to have a width of 30% of the Jframe, while those on the right take 70%.

I use the command AbstractCDockable.setResizeRequest(new Dimension(width, height), true); and sometimes (not always), I have the following error:

Exception in thread „AWT-EventQueue-0“ java.lang.NullPointerException
at bibliothek.gui.dock.facile.station.split.LockedResizeLayoutManager.toElement(LockedResizeLayoutManager.java:152)
at bibliothek.gui.dock.facile.station.split.ResizeRoot.(ResizeRoot.java:51)
at bibliothek.gui.dock.facile.station.split.LockedResizeLayoutManager.toElement(LockedResizeLayoutManager.java:147)
at bibliothek.gui.dock.facile.station.split.LockedResizeLayoutManager.updateBoundsLocked(LockedResizeLayoutManager.java:111)
at bibliothek.gui.dock.facile.station.split.LockedResizeLayoutManager.updateBounds(LockedResizeLayoutManager.java:95)
at bibliothek.gui.dock.SplitDockStation.updateBounds(SplitDockStation.java:2584)
at bibliothek.gui.dock.SplitDockStation$Content.doLayout(SplitDockStation.java:2639)
at java.awt.Container.validateTree(Container.java:1507)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validate(Container.java:1480)
at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:669)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Thanks for the information, I’ll try and reproduce the bug. The “sometimes” is of course not nice, any chance that could be related to a threading issue? Like calling setRestrictedSize not in the EventDispatchThread?

Maybe, I indeed use threads in my application. I will try to execute this request in the EDT and see if it still happens. But as you said, the „sometimes“ is not very nice.
Regards,
Ben

[QUOTE=Benoît Thiébault;15222]Maybe, I indeed use threads in my application. I will try to execute this request in the EDT and see if it still happens. But as you said, the „sometimes“ is not very nice.
Regards,
Ben[/QUOTE]

Hi again,

I changed my method call to make it run in the EDT (via the SwingUtilities.invokeLater(Runnable) method) and just got the null pointer exception again. The rezising worked, but I got the stack trace anyway…

P.S. : It would also be nice to have a forum in English. My Deutsch is not very good at the moment and I have had some difficulty to answer the anti-spam question :slight_smile:

Forget (and forgive) my remark, I just found how to switch languages :slight_smile:

Ok. I did not yet find the time to work on the bug, but I’ll sure (try to) fix it before the next release.

Thank you very much.

I even have a present for you: a new stack trace :smiley:

I guess it is not related to the previous one (maybe a Nimbus bug?), and it also seems random:

Exception in thread „AWT-EventQueue-0“ java.lang.NullPointerException
at javax.swing.plaf.synth.SynthLabelUI.getPreferredSize(SynthLabelUI.java:181)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at javax.swing.plaf.basic.BasicSliderUI.paintHorizontalLabel(BasicSliderUI.java:1129)
at javax.swing.plaf.basic.BasicSliderUI.paintLabels(BasicSliderUI.java:1103)
at javax.swing.plaf.basic.BasicSliderUI.paint(BasicSliderUI.java:912)
at com.artenum.tk.color.ColorGradientSliderUI.paint(ColorGradientSliderUI.java:320)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:752)
at javax.swing.JComponent.paint(JComponent.java:1029)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at bibliothek.gui.dock.util.BackgroundPanel.paintChildren(BackgroundPanel.java:142)
at javax.swing.JComponent.paint(JComponent.java:1038)
at bibliothek.gui.dock.util.BackgroundPanel.paint(BackgroundPanel.java:86)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at bibliothek.gui.dock.util.BackgroundPanel.paintChildren(BackgroundPanel.java:142)
at javax.swing.JComponent.paint(JComponent.java:1038)
at bibliothek.gui.dock.util.BackgroundPanel.paint(BackgroundPanel.java:86)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at bibliothek.gui.dock.util.BackgroundPanel.paintChildren(BackgroundPanel.java:142)
at javax.swing.JComponent.paint(JComponent.java:1038)
at bibliothek.gui.dock.util.BackgroundPanel.paint(BackgroundPanel.java:86)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at bibliothek.gui.dock.util.BackgroundPanel.paintChildren(BackgroundPanel.java:142)
at javax.swing.JComponent.paint(JComponent.java:1038)
at bibliothek.gui.dock.util.BackgroundPanel.paint(BackgroundPanel.java:86)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
at javax.swing.JComponent._paintImmediately(JComponent.java:5072)
at javax.swing.JComponent.paintImmediately(JComponent.java:4882)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

I think that is a bug of Nimbus, especially if it works with other Look-and-Feels. It seems to paint some Component (a JSlider?) which has no preferred size? DockingFrames itself should not create such a component, and if so the exception would appear the whole time.

Hi,

Last stack trace was indeed a Nimbus problem, not a DockingFrames problem. I had today a new NullPointerException that I think is related to the library. Have you already seen this problem ?


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at bibliothek.gui.dock.station.split.DefaultSplitLayoutManager.validateDivider(DefaultSplitLayoutManager.java:350)
	at bibliothek.gui.dock.station.split.DefaultSplitLayoutManager.validateDivider(DefaultSplitLayoutManager.java:313)
	at bibliothek.gui.dock.facile.station.split.DelegatingSplitLayoutManager.validateDivider(DelegatingSplitLayoutManager.java:76)
	at bibliothek.gui.dock.SplitDockStation$Access.validateDivider(SplitDockStation.java:3048)
	at bibliothek.gui.dock.station.split.Node.updateBounds(Node.java:361)
	at bibliothek.gui.dock.station.split.Root.updateBounds(Root.java:317)
	at bibliothek.gui.dock.station.split.DefaultSplitLayoutManager.updateBounds(DefaultSplitLayoutManager.java:393)
	at bibliothek.gui.dock.facile.station.split.DelegatingSplitLayoutManager.updateBounds(DelegatingSplitLayoutManager.java:72)
	at bibliothek.gui.dock.facile.station.split.LockedResizeLayoutManager.updateBounds(LockedResizeLayoutManager.java:99)
	at bibliothek.gui.dock.SplitDockStation.updateBounds(SplitDockStation.java:2755)
	at bibliothek.gui.dock.SplitDockStation$Content.doLayout(SplitDockStation.java:2810)
	at java.awt.Container.validateTree(Container.java:1507)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validateTree(Container.java:1513)
	at java.awt.Container.validate(Container.java:1480)
	at java.awt.Window.dispatchEventImpl(Window.java:2476)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
	at java.awt.EventQueue.access$000(EventQueue.java:84)
	at java.awt.EventQueue$1.run(EventQueue.java:602)
	at java.awt.EventQueue$1.run(EventQueue.java:600)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:616)
	at java.awt.EventQueue$2.run(EventQueue.java:614)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

I have not seen this error, seems to be one of the errors that are rather random. I’ll add some code to prevent this exception in the next version.

[Edit: and the next release should be online this weekend]

[QUOTE=Beni]I have not seen this error, seems to be one of the errors that are rather random. I’ll add some code to prevent this exception in the next version.

[Edit: and the next release should be online this weekend][/QUOTE]

That’s good news !
Did you have time to fix the problem I mentionned in my first message as well ?

I’ve added some more checks, I’m not sure if it will actually work as I was not able to find out what actually did go wrong. It is possible that the exception now just appears at another location, but at least that would be nearer at the source of the bug.