This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
We have an application with frequent non user generated events adding and removing nodes. The nodes are displayed in an outline view. When the events are frequent 10-20/second we eventually get the exception below. A quick look at the source indicates that the check indices.length == 1 should probably be indices.length == 0 The effect of the exception is quite severe as the table completely stops responding to future events. If you have any ideas for a workaround it would be greatly appreciated as we are closing in on release date. Many Thanks David ---- SOURCE --------- private static boolean isDiscontiguous (TreeModelEvent e) { int[] indices = e.getChildIndices(); if (indices == null || indices.length == 1) { return false; } Arrays.sort(indices); int lastVal = indices[0]; for (int i=1; i < indices.length; i++) { if (indices[i] != lastVal + 1) { return true; } else { lastVal++; } } return false; } ------------ STACKTRACE ------------------- java.lang.ArrayIndexOutOfBoundsException: 0 at org.netbeans.swing.outline.EventBroadcaster.isDiscontiguous(EventBroadcaster.java:824) at org.netbeans.swing.outline.EventBroadcaster.translateEvent(EventBroadcaster.java:598) at org.netbeans.swing.outline.EventBroadcaster.treeNodesInserted(EventBroadcaster.java:368) at org.openide.explorer.view.NodeTreeModel.nodesWereInsertedInternal(NodeTreeModel.java:177) at org.openide.explorer.view.NodeTreeModel$Listener.added(NodeTreeModel.java:218) at org.openide.explorer.view.VisualizerChildren.added(VisualizerChildren.java:230) at org.openide.explorer.view.VisualizerEvent$Added.run(VisualizerEvent.java:106) at org.openide.util.Mutex.readAccess(Mutex.java:362) at org.openide.util.Mutex$1R.run(Mutex.java:1301) at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1812) at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1320) at org.openide.util.Mutex.readAccess(Mutex.java:351) at org.openide.explorer.view.VisualizerNode$QP.run(VisualizerNode.java:676) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:125) 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, I've just started to work on the fix today... The root of the problems actually seems to be in the nodes, where changes in children are fired.
It's fixed in changeset: 174616:25acba01ff82 in trunk.
http://hg.netbeans.org/main/rev/25acba01ff82
Integrated into 'main-golden', will be available in build *201007230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/25acba01ff82 User: mentlicher@netbeans.org Log: #188822 Assure that we do not notify about addition or removal of empty set of nodes. It cause problems in listeners that do not count with that and it is not necessary anyway.
Hi, I'm also experiencing this problem using Nodes in a standalone program. The version I'm using is from NB 6.9.1 (see below). I'm attaching some logs I'm getting just in case it helps. Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.0 Created-By: 1.6.0_18-b07 (Sun Microsystems Inc.) OpenIDE-Module-Public-Packages: org.openide.cookies.*, org.openide.nod es.*, org.openide.util.actions.* OpenIDE-Module-Module-Dependencies: org.openide.awt > 7.10, org.openid e.dialogs > 6.2, org.openide.util > 8.0, org.openide.util.lookup > 8. 0 OpenIDE-Module-Java-Dependencies: Java > 1.6 OpenIDE-Module-Implementation-Version: 201007282301 AutoUpdate-Show-In-Client: false OpenIDE-Module: org.openide.nodes OpenIDE-Module-Localizing-Bundle: org/openide/nodes/Bundle.properties AutoUpdate-Essential-Module: true OpenIDE-Module-Specification-Version: 7.16.1 OpenIDE-Module-Requires: org.openide.modules.ModuleFormat1
Created attachment 105400 [details] Some logs These logs appear automatically when this happens.
The problem seems to happen when a FilterNode has no children.
Target Milestone is set to 7.0. Therefore this is NOT solved in NB 6.9.1. It's fixed in 7.0 dev builds.
Ah, I see. Yes, I've tried out NB 7.0 Beta jars and things work smoothly. Sorry for the noise, Antonio
Although this issue is already fixed, I would like to add that it happens when I have a FilterNode, and I exclude some nodes. At the time I add a node that is supposed to be excluded, i.e. I don't want that Node among my children, I have this exception. this is the code: <code> public class HomeChildrenFilter extends FilterNode.Children{ private java.util.Map<Node, Node> keys2nodes = new HashMap<Node, Node>(); private java.util.Map<Node, Node> nodes2keys = new HashMap<Node, Node>(); public HomeChildrenFilter(HomeNode owner) { super(owner); } @Override protected Node[] createNodes(Node object) { if (accept(object)) { Node[] result = super.createNodes(object); keys2nodes.put(object, result[0]); nodes2keys.put(result[0], object); return result; } return new Node[]{}; } public Node getNode(Node key){ return keys2nodes.get(key); } public Node getKey(Node object){ return nodes2keys.get(object); } private boolean accept(Node node) { //I only want to show HomePieceOfFurnitureNode nodes. //The rest, I don't care return (node instanceof HomePieceOfFurnitureNode); } } public class HomeFilter extends FilterNode{ private HomeNode homeNode; public HomeFilter(HomeNode original, Children children, Lookup lookup) { super(original, children, lookup); homeNode = original; } public HomeFilter(HomeNode original, Children children) { super(original, children); homeNode = original; } public HomeFilter(HomeNode original) { super(original, new HomeChildrenFilter(original)); homeNode = original; } } </code> Whenever I add a non HomePieceOfFurnitureNode, I have the exception; no matter how many HomePieceOfFurnitureNode I already have at Home. That's just for accounting (or forensics) purposes. Anyway, is there any workarround for 6.9.1? I'm working on a production environment and I don't think I can wait to 7.0 for delivery.