• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Exception in JTree updating

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have constructed a tree and when ever any change occured to the tree i am sending an event from server which will notify all the clients.
Then the tree is refreshed by using TreeModelEvent methods like nodeInserted, nodesRemoved, nodesModified etc.

The no of events generated are so many that if there are 20 nodes then for each second say for each node there will be 10 updates.

At this time i am getting exception saying

java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:431)
at javax.swing.tree.DefaultMutableTreeNode.getChildAt(DefaultMutableTreeNode.java:230)
at javax.swing.tree.VariableHeightLayoutCache$VisibleTreeStateNodeEnumeration.updateNextIndex(VariableHeightLayoutCache.java:1739)
at javax.swing.tree.VariableHeightLayoutCache$VisibleTreeStateNodeEnumeration.updateNextObject(VariableHeightLayoutCache.java:1690)
at javax.swing.tree.VariableHeightLayoutCache$VisibleTreeStateNodeEnumeration.nextElement(VariableHeightLayoutCache.java:1681)
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1121)
at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:152)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at javax.swing.JComponent._paintImmediately(JComponent.java:4685)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

This is a big problem for me and i have to fix it as early as possible.

Thanks in advance
Posts: 4278
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same bug and it is *very* hard to reproduce but appears to be a Swing bug. Here's my stack trace:

I've searched google and the usual places and read through the source, but no luck. It appears to be a threading error, the thread from the stack trace shown makes a request to view the last element of an array but sometime between getting the index and accessing the data, the array is decrement by one.

None of my code modifies the tree (that I'm aware of).

Could use some help on this one.
[ June 16, 2006: Message edited by: Scott Selikoff ]
Posts: 73981
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nasir Ahamed, welcome to the Ranch.

I presume you have been through the lines quoted, and investigated the usual suspects? Your error message 0 >= 0 suggests you have a zero-member array.

Are you sure this really is a bug? If you think it is, have you checked the bugs database?

I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic