Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357367 - NPE when ScriptSource#clearBreakpoints is called.
Summary: NPE when ScriptSource#clearBreakpoints is called.
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: Debug (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Project Inbox CLA
QA Contact: Michael Rennie CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-12 08:16 EDT by lex78 CLA
Modified: 2011-09-12 10:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lex78 CLA 2011-09-12 08:16:23 EDT
Build Identifier: 20110615-0604

org.eclipse.wst.jsdt.debug.internal.rhino.debugger.ScriptSource#clearBreakpoints throws and NPE exception when it gets the breakpoint from the lines[0].breakpoint 

for (int i = 0; i < this.lines.length; i++) {
Breakpoint bp = lines[i].breakpoint;  => NPE Exception!!!

The constructor fill the array from lines[1] to lines[lineNumbers+1].
				

Reproducible: Always

Steps to Reproduce:
1.Start debugging a JS Script. It  triggers the RhinoDebuggerImpl.handleCompilationDone() and it puts the script into the "uriToScript"
2.Update the script so it triggers again the call of RhinoDebuggerImpl.handleCompilationDone() and it finds the "ScriptSource old = (ScriptSource) uriToScript.remove(uri);" old script. 
3.The old.clearBreakpoints(this); in line 156 throws NPE
Comment 1 Michael Rennie CLA 2011-09-12 10:25:31 EDT
Thanks for the bug and the assessment of the problem!

We should be checking the line data for existence like we do pretty much everywhere else in ScriptSource.

Applied check to HEAD.