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

Bug 322860

Summary: NPE after failed lookup request
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.2.1   
Target Milestone: 3.3 M2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix none

Description Michael Rennie CLA 2010-08-16 23:00:34 EDT
code from HEAD

If a lookup request fails, we get this pleasant NPE:

java.lang.NullPointerException
at org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.StackFrameImpl.initializeVariables(StackFrameImpl.java:200)
at org.eclipse.wst.jsdt.debug.internal.rhino.jsdi.StackFrameImpl.variables(StackFrameImpl.java:182)
at org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptStackFrame.getVariables(JavaScriptStackFrame.java:140)
at org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider.getAllChildren(StackFrameContentProvider.java:51)
at org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider.getChildCount(StackFrameContentProvider.java:28)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.retrieveChildCount(ElementContentProvider.java:114)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$2.run(ElementContentProvider.java:63)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

We should be asking the response for its success and doing the right thing when it fails.
Comment 1 Michael Rennie CLA 2010-08-26 14:09:34 EDT
Created attachment 177553 [details]
fix

The patch checks the response status, and does nothing if not successful. It no longer returns null from the variables() call (obeying the API contract) and does not initialize the variables cache when a failure happens - which allows it to try again to get the variables.
Comment 2 Michael Rennie CLA 2010-08-26 14:10:09 EDT
applied to HEAD