Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes Exception in JTree updating Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception in JTree updating " Watch "Exception in JTree updating " New topic
Author

Exception in JTree updating

Nasir Ahamed
Greenhorn

Joined: Mar 17, 2006
Posts: 1
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
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700
    
    5

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 ]

My Blog: Down Home Country Coding with Scott Selikoff
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37884
    
  22
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?

CR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in JTree updating
 
Similar Threads
Exception in thread "AWT-EventQueue-0" error
Error while Entering Jpn characters on UI
Java 2D Text Rendering Problems!
Exception when using Nimbus LaF
Null pointer exception.....