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.

Bug 126560

Summary: ArrayIndexOutOfBoundsException: node has no children
Product: platform Reporter: _ gtzabari <gtzabari>
Component: ExplorerAssignee: t_h <t_h>
Status: VERIFIED FIXED    
Severity: blocker CC: ivan, jgrodnik, mmirilovic, pjiricka, sustaining, unr303
Priority: P1    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=3174
Issue Type: DEFECT Exception Reporter: 3174
Attachments: stacktrace
stacktrace
stacktrace
ide log
ide log
stack traces
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
path for 61_fixes
corrected patch for 61_fixes

Description _ gtzabari 2008-02-03 03:25:42 UTC
Build: NetBeans IDE Dev (Build 200802021203)
VM: Java HotSpot(TM) Client VM, 11.0-b11
OS: Windows Vista, 6.0, x86

User Comments: 
1) The watch window contains the name of a List
2) I set a breakpoint
3) The first time the breakpoint is hit the list contains one element. I expand it by clicking on the plus sign to the left of the variable name.
4) I hit F5 (continue), the breakpoint is hit a second time. I get the aforementioned exception because the list now contains zero elements.
Comment 1 _ gtzabari 2008-02-03 03:25:46 UTC
Created attachment 55959 [details]
stacktrace
Comment 2 Exceptions Reporter 2008-02-05 04:41:46 UTC
THIS ISSUE HAS ALREADY 20 DUPLICATES
Comment 3 t_h 2008-02-11 16:40:18 UTC
*** Issue 126576 has been marked as a duplicate of this issue. ***
Comment 4 navid50 2008-02-12 10:17:27 UTC
Build: NetBeans IDE Dev (Build 200711050000)
VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06
OS: Windows XP, 5.1, x86

User Comments: 
Comment 5 navid50 2008-02-12 10:17:31 UTC
Created attachment 56503 [details]
stacktrace
Comment 6 _ pcw 2008-02-29 21:40:24 UTC
Build: NetBeans IDE Dev (Build 080218)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: SunOS, 5.10, x86

User Comments: 
debugging with watch window visible, variable using tree view open and visible in watch window, ran to new code that forced close of that variable tree.
Comment 7 _ pcw 2008-02-29 21:40:28 UTC
Created attachment 57584 [details]
stacktrace
Comment 8 Petr Jiricka 2008-03-03 07:34:21 UTC
Considering the number of duplicates (see also 
http://statistics.netbeans.org/analytics/detail.do?id=9728
http://statistics.netbeans.org/analytics/detail.do?id=3174), 

I'd say this is really a P2. This was also brought up on the dev@ruby.netbeans.org alias.

Needs to be reevaluated, e.g. I don't see any comment from the responsible engineer stating whether he is able to reproduce.
Comment 9 t_h 2008-03-04 08:33:20 UTC
I am able to reproduce. It seems it is race condition during rebuilding tree in watches.
Comment 11 t_h 2008-03-12 17:41:39 UTC
*** Issue 85770 has been marked as a duplicate of this issue. ***
Comment 12 unr303 2008-04-10 08:39:38 UTC
clean+build project -> exception
Comment 13 unr303 2008-04-10 08:40:06 UTC
Created attachment 59951 [details]
ide log
Comment 14 Marian Mirilovic 2008-04-10 12:29:47 UTC
It looks like the exception is not fixed in NB 6.1 ...
Comment 15 t_h 2008-04-10 12:58:47 UTC
It was fixed for supplied case. I cannot reproduce it anymore. If possible, please provide steps how to reproduce.
Comment 16 unr303 2008-04-17 15:17:32 UTC
Invoking code completion
Comment 17 unr303 2008-04-17 15:18:00 UTC
Created attachment 60343 [details]
ide log
Comment 18 Lukas Hasik 2008-04-29 08:20:02 UTC
unr303, does it still happen? What file you are invoking th CC in? What project? Could you attach it to this issue?
Could you try to run IDE with -J-Dname.of.the.Logger.level=100 and reproduce it. Then attach the messages.log again.

thank you
Comment 19 unr303 2008-04-29 08:51:30 UTC
I dont believe i have reproducible test case.
Comment 20 ivan 2008-05-24 00:59:00 UTC
There seems to be an unintended side-effect to this fix.
In sunstudio, we have hierarchies of bpts. 
If a bpt has two or more children, sometimes when I delete them
the objects all go away but the root node is still visible in the TTV.

One manifestation was that I see VisualizerEvent.Removed getting created but
Removed.run() not getting called in the failing cases.

I traced this to VisualizerNode.QP.run() and this:
                // #126560 - remove subsequent element after structural change
                if (r instanceof PropLeafChange && en.hasMoreElements()) {
                    r = en.nextElement();
                    LOG.log(Level.FINER, "Removing {0}", r); // NOI18N
                }
It seems that this code may delete events it shouldn't.
I think the scenario I'm running into is if a delete of a parent
is scheduled before the delete of a child. Then the removal of the child
plus the above code cancels the delete of the parent.
Comment 21 t_h 2008-05-27 15:24:22 UTC
Alternative fix to avoid reported side-effect:
http://hg.netbeans.org/core-main/rev/05699bd83401
Comment 22 Quality Engineering 2008-06-03 04:13:27 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #234 build
Changeset: http://hg.netbeans.org/main/rev/05699bd83401
User: Tomas Holy <t_h@netbeans.org>
Log: #126560: different fix to avoid reported side effects
Comment 23 ivan 2008-06-03 23:57:41 UTC
I checked against the trunk.
The new fix seems to make the symptoms of bpts not getting deleted go away.
Comment 24 Lukas Hasik 2008-06-04 14:50:36 UTC
I marking as fixed again - based on ivan last comment. 
Verification of this fix would be highly appreciated.
Comment 25 pgebauer 2008-06-10 13:53:26 UTC
This issue has been nominated for NB IDE 6.1 patch2 although it hasn't been verified by QE yet. If it isn't verified by
12-Jun-08, it's nomination will be removed.
Comment 26 Alexander Pepin 2008-06-11 20:32:03 UTC
As there is no possibility to verify it in SS IDE based on NB trunk build I mark this issue as verified according to
Ivan's last comment.
Comment 27 pgebauer 2008-06-12 18:18:23 UTC
The fix has been ported into the release61_fixes branch:

http://hg.netbeans.org/release61_fixes/2d096485b5bc
Comment 28 _ pcw 2008-06-24 20:36:35 UTC
This is still happening, reopening.

I've attached two instances that occurred during a debugging session.  Highly possible that this is caused by a race
condition in my cirumstance, as debugger was quite active at the time (logging breakpoints active and debuggee task
running.)

Comment 29 _ pcw 2008-06-24 20:37:04 UTC
Created attachment 63363 [details]
stack traces
Comment 30 _ pcw 2008-06-24 20:37:40 UTC
This was with a 20 June 2008 build from deadlock.
Comment 31 Jaromir Uhrik 2008-06-30 16:52:10 UTC
I have spoken with t_h and it seems that this issue is partially fixed - there are some cases where the issue probably
still appears, but we don't have steps to reproduce. It looks like the fix is not risky and should stay in the patch2.
Tomasi, could you please confirm this.
Thanks.
Comment 32 t_h 2008-06-30 17:09:04 UTC
Yes, the fix is valid for reported reproducible case. Unfortunately, it seems there is still some issue which we were
not able to reproduce so far.
Comment 33 Tomas Mysik 2008-07-15 11:29:35 UTC
Build: NetBeans IDE Dev (Build 200807040101)
VM: Java HotSpot(TM) Server VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Linux, 2.6.25-gentoo-r6, i386

User Comments: 
Comment 34 Petr Chytil 2008-07-15 12:08:51 UTC
Build: NetBeans IDE Dev (Build 200807101204)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b22
OS: Windows Vista, 6.0, x86

User Comments: 
Debugging simple JSP file. Exception happened after "step in" action.
Comment 35 Petr Chytil 2008-07-15 12:09:07 UTC
Created attachment 64542 [details]
stacktrace
Comment 36 Petr Chytil 2008-07-15 12:09:40 UTC
Build: NetBeans IDE Dev (Build 200807101204)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b22
OS: Windows Vista, 6.0, x86

User Comments: 
Debugging simple JSP file. Exception happened after "step in" action.
Comment 37 Petr Chytil 2008-07-15 12:09:48 UTC
Created attachment 64543 [details]
stacktrace
Comment 38 ranbato 2008-07-16 21:09:21 UTC
Build: NetBeans IDE Dev (Build 200807101204)
VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02
OS: Windows XP, 5.1, x86

User Comments: 
Stepping through Debugger
Comment 39 ranbato 2008-07-16 21:09:29 UTC
Created attachment 64767 [details]
stacktrace
Comment 40 pbelbin 2008-07-21 00:50:14 UTC
Build: NetBeans IDE Dev (Build 200807170007)
VM: Java HotSpot(TM) 64-Bit Server VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Windows Vista, 6.0, amd64

User Comments: 
tried to select the option that allows one to customize the icons on the menu/tool bar.
Comment 41 pbelbin 2008-07-21 00:50:25 UTC
Created attachment 65074 [details]
stacktrace
Comment 42 tonybeckham 2008-07-29 19:26:32 UTC
Build: NetBeans IDE Dev (Build 200807291401)
VM: Java HotSpot(TM) 64-Bit Server VM, 1.6.0_05-b13-52, Java(TM) SE Runtime Environment, 1.6.0_05-b13-120
OS: Mac OS X, 10.5.4, x86_64

User Comments: 
Adding reference to a schema via schema view.  Exception occured expanding nodes under "By File"

Stacktrace: 
java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
        at java.util.Vector.elementAt(Vector.java:427)
        at javax.swing.tree.DefaultMutableTreeNode.getChildAt(DefaultMutableTreeNode.java:230)
        at javax.swing.tree.VariableHeightLayoutCache.treeNodesRemoved(VariableHeightLayoutCache.java:543)
        at javax.swing.plaf.basic.BasicTreeUI$Handler.treeNodesRemoved(BasicTreeUI.java:3815)
        at javax.swing.tree.DefaultTreeModel.fireTreeNodesRemoved(DefaultTreeModel.java:530)
        at javax.swing.tree.DefaultTreeModel.nodesWereRemoved(DefaultTreeModel.java:310)
Comment 43 tonybeckham 2008-07-29 19:26:52 UTC
Created attachment 65975 [details]
stacktrace
Comment 44 Exceptions Reporter 2008-07-30 15:41:40 UTC
This issue has already 100 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=9728
Comment 45 t_h 2008-07-31 22:36:14 UTC
This should be fixed by 9ab9cf9055a9.
Comment 46 ivan 2008-07-31 22:44:37 UTC
I noticed this latest fix is in the visualizer ... 
Has the viewmodel pkg used by debuggers migrated off of TTV to
the new visualizer yet?

Comment 47 rbalada 2008-08-04 15:53:44 UTC
Please note that NetBeans 6.1 Patch3 cut-off is going to happen on close of
business August 5th. If you would like to have bugfix for this issue as part of
NetBeans 6.1 Patch3, then this issue must have information about bugfix' trunk
changeset and it's status must be "VERIFIED".
Comment 48 t_h 2008-08-04 20:10:55 UTC
ivan: I am not sure I understand what you mean by new visualizer. AFAIK debugger is still using TTV. The fix itself is
in VisualizerChildren.
Comment 49 Lukas Hasik 2008-08-05 11:37:17 UTC
the exception haven't appeared from the last fix. I'm marking as VERIFIED to make it available for patch. 

However I'd like to ask Ivan or t_h if they are satisfied with the fix. 
Comment 50 rbalada 2008-08-05 12:51:55 UTC
It looks like the changeset http://hg.netbeans.org/main/rev/9ab9cf9055a9 seems to be completely inapplicable against
release61_fixes repository.

Reasons:
#1 5 out of 5 hunks FAILED to apply in VisualizerChildren.java
#2 1 out of 1 hunk FAILED to apply in VisualizerNode.java
#3 6 out of 6 hunks FAILED to apply in non-existing file EntrySupport.java

It looks like there was significant refactoring, please advise how to fix this in release61_fixes repository.
Comment 51 t_h 2008-08-05 13:26:57 UTC
Created attachment 66591 [details]
path for 61_fixes
Comment 52 t_h 2008-08-05 13:29:49 UTC
I think fix is OK to go to patch 6.1
Comment 53 ivan 2008-08-05 19:29:02 UTC
The main symptom I had experienced was nodes not
getting deleted. I can no longer reproduce this symptom in the trunk.
Comment 54 rbalada 2008-08-06 10:55:20 UTC
I've applied the attached patch http://www.netbeans.org/nonav/issues/showattachment.cgi/66591/61_fixes_126560.diff into
release61_fixes repository as http://hg.netbeans.org/release61_fixes/rev/e35108146308
Comment 55 rbalada 2008-08-07 12:38:13 UTC
Returning 61fixes-candidate keyword. Provided patch introduces compilation errors in patched file.
Comment 56 t_h 2008-08-07 13:25:05 UTC
Created attachment 66807 [details]
corrected patch for 61_fixes
Comment 57 rbalada 2008-08-07 14:30:16 UTC
I've integrated the attached patch http://www.netbeans.org/nonav/issues/showattachment.cgi/66807/61_126560.diff into
release61_fixes repository as http://hg.netbeans.org/release61_fixes/rev/e506fbdbf1b5
Comment 58 Lukas Hasik 2008-08-21 09:54:55 UTC
verified in patch3 (2008-08-12_03-59-31)
Comment 59 Thomas Preisler 2008-09-15 16:51:25 UTC
delivered to SS