Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326431

Summary: ArrayIndexOutOfBoundsException toggling Scripts node
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: VERIFIED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: browe, darin.eclipse, thatnitind
Version: 3.2Flags: darin.eclipse: review+
Target Milestone: 3.2.3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 326971    
Attachments:
Description Flags
fix
none
3.2.2 fix none

Description Michael Rennie CLA 2010-09-28 11:13:11 EDT
code from HEAD

Steps:

1. start a Rhino launch
2. using the Debug view menu, turn the Scripts node on and off
3. should get the following exception when turning off the Scripts node:


java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.debug.internal.ui.viewers.model.ChildrenUpdate.setChild(ChildrenUpdate.java:99)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.retrieveChildren(ElementContentProvider.java:90)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$1.run(ElementContentProvider.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Michael Rennie CLA 2010-09-28 11:38:15 EDT
heres a trace of the exception:


updateChildCount(org.eclipse.debug.internal.core.LaunchManager@42d05e, 1)
	BEGIN - IChildrenCountUpdate: org.eclipse.debug.internal.core.LaunchManager@42d05e
updateElement(org.eclipse.debug.internal.core.LaunchManager@42d05e, 0) > modelIndex = 0
updateElement(org.eclipse.debug.core.Launch@4eeef7, 0) > modelIndex = 0
updateElement(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, 0) > modelIndex = 0
updateElement(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, 1) > modelIndex = 1
coalesced: IChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 {0->2}
updateElement(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, 2) > modelIndex = 2
coalesced: IChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 {0->3}
updateElement(org.eclipse.debug.core.Launch@4eeef7, 1) > modelIndex = 1
coalesced: IChildrenUpdate: org.eclipse.debug.core.Launch@4eeef7 {0->2}
setChildCount(org.eclipse.debug.internal.core.LaunchManager@42d05e, modelCount: 1 viewCount: 1)
	END - IChildrenCountUpdate: org.eclipse.debug.internal.core.LaunchManager@42d05e
	BEGIN - IChildrenUpdate: org.eclipse.debug.internal.core.LaunchManager@42d05e {0->1}
replace(org.eclipse.debug.internal.core.LaunchManager@42d05e, modelIndex: 0 viewIndex: 0, org.eclipse.debug.core.Launch@4eeef7)
updateHasChildren(org.eclipse.debug.core.Launch@4eeef7
	END - IChildrenUpdate: org.eclipse.debug.internal.core.LaunchManager@42d05e {0->1}
LABEL SEQUENCE BEGINS
	BEGIN - ILabelUpdate: org.eclipse.debug.core.Launch@4eeef7
	BEGIN - IHasChildrenUpdate: org.eclipse.debug.core.Launch@4eeef7
setHasChildren(org.eclipse.debug.core.Launch@4eeef7 >> true
updateChildCount(org.eclipse.debug.core.Launch@4eeef7, 2)
	END - IHasChildrenUpdate: org.eclipse.debug.core.Launch@4eeef7
	BEGIN - IChildrenCountUpdate: org.eclipse.debug.core.Launch@4eeef7
setChildCount(org.eclipse.debug.core.Launch@4eeef7, modelCount: 2 viewCount: 2)
	END - IChildrenCountUpdate: org.eclipse.debug.core.Launch@4eeef7
	BEGIN - IChildrenUpdate: org.eclipse.debug.core.Launch@4eeef7 {0->2}
replace(org.eclipse.debug.core.Launch@4eeef7, modelIndex: 0 viewIndex: 0, org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722)
updateHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
replace(org.eclipse.debug.core.Launch@4eeef7, modelIndex: 1 viewIndex: 1, org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a)
updateHasChildren(org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a
	END - IChildrenUpdate: org.eclipse.debug.core.Launch@4eeef7 {0->2}
	BEGIN - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
	BEGIN - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a
	BEGIN - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
	END - ILabelUpdate: org.eclipse.debug.core.Launch@4eeef7
	END - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
	END - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a
LABEL SEQUENCE ENDS
setHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 >> true
updateChildCount(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, 3)
	END - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
	BEGIN - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a
setHasChildren(org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a >> false
	END - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.rhino.ui.launching.RhinoProcess@9bee3a
	BEGIN - IChildrenCountUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
setChildCount(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, modelCount: 2 viewCount: 2)
	END - IChildrenCountUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722
	BEGIN - IChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 {0->3}
replace(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, modelIndex: 0 viewIndex: 0, org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c)
updateHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c
replace(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, modelIndex: 1 viewIndex: 1, org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e)
updateHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e
	END - IChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 {0->3}
updateElement(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722, 1) > modelIndex = 1
LABEL SEQUENCE BEGINS
	BEGIN - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c
	BEGIN - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e
	BEGIN - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c
	BEGIN - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e
setHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c >> false
	END - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c
	BEGIN - IChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptDebugTarget@d62722 {1->2}
setHasChildren(org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e >> false
	END - IHasChildrenUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e
	END - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@103462c
	END - ILabelUpdate: org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread@1fb14e
LABEL SEQUENCE ENDS
Comment 2 Michael Rennie CLA 2010-09-28 12:49:19 EDT
Created attachment 179764 [details]
fix

seems we should have been calling getElements(..) instead of returning a raw array of children on the getChildren(...) callback.
Comment 3 Michael Rennie CLA 2010-09-28 12:50:01 EDT
applied to HEAD, please verify Darin W
Comment 4 Darin Wright CLA 2010-09-28 14:03:45 EDT
Verified I no longer see the exception.
Comment 5 Billy Rowe CLA 2010-09-30 16:17:14 EDT
Hi Michael,

We're working with John Barton, who I understand is working with you on this. 
Would it be possible to get a version we could patch 3.2.2 with?

Thanks
Billy
Comment 6 Michael Rennie CLA 2010-09-30 16:53:53 EDT
Created attachment 180000 [details]
3.2.2 fix

Certainly. This patch is against the 3.2.2 maintenance branch.
Comment 7 Billy Rowe CLA 2010-09-30 17:05:19 EDT
Thanks for the super fast turnaround Michael.

Would it also be possible to get this targeted to 3.2.3 so we can avoid having to patch it?

Thanks
Billy
Comment 8 Michael Rennie CLA 2010-10-01 10:03:47 EDT
(In reply to comment #7)

> Would it also be possible to get this targeted to 3.2.3 so we can avoid having
> to patch it?

Certainly, I released the patch to 3.2.3 as well.