[sip-comm-dev] [PATCH] Fix for NoSuchElementException in ContactListTreeModel


#1

Hi,
this bug is easy to reproduce :
type anything in the search field (like "dgdfgdfg") so you don't see any
contact.
Then press page up or page down, you'll get

     [java] 14:51:19.689 GRAVE: util.UtilActivator.uncaughtException().80 An
uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main] and
message was: node has no children
     [java] java.util.NoSuchElementException: node has no children
     [java] at
javax.swing.tree.DefaultMutableTreeNode.getFirstChild(DefaultMutableTreeNode.java:864)
     [java] at
net.java.sip.communicator.impl.gui.main.contactlist.ContactListTreeModel.findFirstContactNode(ContactListTreeModel.java:127)
     [java] at
net.java.sip.communicator.impl.gui.main.contactlist.ContactListTreeModel.findFirstContactNode(ContactListTreeModel.java:100)
     [java] at
net.java.sip.communicator.impl.gui.main.contactlist.TreeContactList.selectFirstContact(TreeContactList.java:743)
     [java] at
net.java.sip.communicator.impl.gui.main.MainFrame$MainKeyDispatcher.dispatchKeyEvent(MainFrame.java:1431)
     [java] at
java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962)
     [java] at
java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
     [java] at
java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
     [java] at java.awt.Component.dispatchEventImpl(Component.java:4502)
     [java] at java.awt.Container.dispatchEventImpl(Container.java:2099)
     [java] at java.awt.Window.dispatchEventImpl(Window.java:2475)
     [java] at java.awt.Component.dispatchEvent(Component.java:4460)
     [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     [java] at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
     [java] at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
     [java] at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
     [java] at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
     [java] at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
     [java] at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Matthieu

Fix_NoSuchElementException_in_ContactListTreeModel.patch (1.26 KB)


#2

Hi Matthieu,

Good catch! Applied, committed and ack-ed.

Cheers,
Yana

···

On Feb 16, 2010, at 3:07 PM, Matthieu Casanova wrote:

Hi,
this bug is easy to reproduce :
type anything in the search field (like "dgdfgdfg") so you don't see any contact.
Then press page up or page down, you'll get

     [java] 14:51:19.689 GRAVE: util.UtilActivator.uncaughtException().80 An uncaught exception occurred in thread=Thread[AWT-EventQueue-0,6,main] and message was: node has no children
     [java] java.util.NoSuchElementException: node has no children
     [java] at javax.swing.tree.DefaultMutableTreeNode.getFirstChild(DefaultMutableTreeNode.java:864)
     [java] at net.java.sip.communicator.impl.gui.main.contactlist.ContactListTreeModel.findFirstContactNode(ContactListTreeModel.java:127)
     [java] at net.java.sip.communicator.impl.gui.main.contactlist.ContactListTreeModel.findFirstContactNode(ContactListTreeModel.java:100)
     [java] at net.java.sip.communicator.impl.gui.main.contactlist.TreeContactList.selectFirstContact(TreeContactList.java:743)
     [java] at net.java.sip.communicator.impl.gui.main.MainFrame$MainKeyDispatcher.dispatchKeyEvent(MainFrame.java:1431)
     [java] at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962)
     [java] at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
     [java] at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
     [java] at java.awt.Component.dispatchEventImpl(Component.java:4502)
     [java] at java.awt.Container.dispatchEventImpl(Container.java:2099)
     [java] at java.awt.Window.dispatchEventImpl(Window.java:2475)
     [java] at java.awt.Component.dispatchEvent(Component.java:4460)
     [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     [java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
     [java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
     [java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
     [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
     [java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
     [java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Matthieu
<Fix_NoSuchElementException_in_ContactListTreeModel.patch>---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net