Menu

#73 setHideRepresentativeButtonOnVisible causes NPE

open
None
5
2009-12-11
2009-10-08
No

Bug occured on the latest trunk. There is a regression with setHideRepresentativeButtonOnVisible feature: if set as true causes null pointer exceptions.

Reproducing: In MyDoggySet add dockedTypeDescriptor.setHideRepresentativeButtonOnVisible(true); for the first tool (near line 270)

After starting demo set, if you click on tool1 you will see stacktrace:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.noos.xing.mydoggy.plaf.ui.look.ToolWindowRepresentativeAnchorUI$ToolWindowRepresentativeAnchorMouseAdapter.mouseClicked(ToolWindowRepresentativeAnchorUI.java:448)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:252)
at java.awt.Component.processMouseEvent(Component.java:6266)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
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)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.noos.xing.mydoggy.plaf.ui.look.ToolWindowRepresentativeAnchorUI$ToolWindowRepresentativeAnchorMouseAdapter$1.run(ToolWindowRepresentativeAnchorUI.java:435)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
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)

The reason of it is calling uninstallUI() which dropping references to components before all pending actions are finished.

Discussion

  • Angelo De Caro

    Angelo De Caro - 2009-10-22

    Hi Vyacheslav,
    I apologize for the tardiness of this answer. Anyway, I think I have resolved the problem.

    Thanks for the feedback,
    --angelo

     
  • Angelo De Caro

    Angelo De Caro - 2009-10-22
    • assigned_to: nobody --> adecaro
     
  • Vyacheslav Rusakov

    Hello Angelo,

    Thank you for fix!

    Auto hiding is working now, but with a little note:
    code dockedTypeDescriptor.setHideRepresentativeButtonOnVisible(true);
    must be called BEFORE toolWindow.setVisible true
    (the use case is to set tool window active by default)

    if dockedTypeDescriptor.setHideRepresentativeButtonOnVisible(true); is called AFTER tool activation, tool's tab area is never hided

    I can ensure you that on earlier mydoggy versions sequence (toolWindow.setVisible true; dockedTypeDescriptor.setHideRepresentativeButtonOnVisible(true);) was working normally (can't tell you exact working revision, but it's near the change that cause original bug)

    I consider its a bug too.

     
  • Angelo De Caro

    Angelo De Caro - 2009-12-06
    • status: open --> closed
     
  • Vyacheslav Rusakov

    Hello Angelo,

    You closed ticked, but what about behavior change described in comment before?

     
  • Vyacheslav Rusakov

    • status: closed --> open
     
  • Angelo De Caro

    Angelo De Caro - 2009-12-08

    Hi xvik,
    I think to have fixed the bug. Please checkout the latest head and execute your test-case.

    Best,
    ./angelo

     
  • Angelo De Caro

    Angelo De Caro - 2009-12-08
    • status: open --> closed
     
  • Vyacheslav Rusakov

    Hello Angelo,

    With little modifications in my code everything works fine. Thank you.

    But, just for your information.. it is possible to make an error. Here is an example (sorry, don't know how to attach file here):
    I took TutorialSet3.java and modify it a little:

    86: ToolWindow debugTool = toolWindowManager.getToolWindow("Debug");
    87: debugTool.setVisible(true); // added line

    111: dockedTypeDescriptor.setAnimating(true);
    112: dockedTypeDescriptor.setHideRepresentativeButtonOnVisible(true); // added line

    Try to launch modified demo and you will see ether unstable work or at least non hidden left bar.

     
  • Vyacheslav Rusakov

    • status: closed --> open
     
  • Angelo De Caro

    Angelo De Caro - 2009-12-12

    Fixed. Thanks for the useful feedback. :)

    ./angelo

     
Auth0 Logo