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

Bug 233309

Summary: NPE thrown if HTML model is busy / unavailable from JSDT outline provider
Product: [WebTools] JSDT Reporter: Bradley Childs <childsb>
Component: GeneralAssignee: Bradley Childs <childsb>
Status: RESOLVED WORKSFORME QA Contact: Phil Berkland <berkland>
Severity: normal    
Priority: P3 CC: david_williams, hjzhang, thatnitind
Version: unspecifiedFlags: david_williams: pmc_approved-
childsb: pmc_approved? (raghunathan.srinivasan)
childsb: pmc_approved? (naci.dai)
deboer: pmc_approved+
childsb: pmc_approved? (neil.hauge)
childsb: pmc_approved? (kaloyan)
childsb: review? (berkland)
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_deferred
Attachments:
Description Flags
patch to catch any NPEs from null HTML model none

Description Bradley Childs CLA 2008-05-21 14:46:06 EDT
NPE in log if HTML model isn't available when the JSDT content outline tries to parse the HTML file.  

This happens frequently if user rapidly edits many HTML files.
Comment 1 Bradley Childs CLA 2008-05-21 14:48:41 EDT
Created attachment 101343 [details]
patch to catch any NPEs from null HTML model

fix to catch/ignore NPE.  js content outline will be unavailable until html model is ready.
Comment 2 Nitin Dahyabhai CLA 2008-05-21 22:29:07 EDT
Also solves (includes solution for) bug 231878.
Comment 3 Tim deBoer CLA 2008-05-28 17:42:50 EDT
Approved provided you remove the TODOs and commented out e.printStackTrace() and add proper tracing or a comment why it is not required in each case... or at least open a bug to do this in 3.0.1.
Comment 4 David Williams CLA 2008-05-28 20:12:31 EDT
I do hate to see code like this ... 

catch(Exception e){
  // do nothing
}

Why must this be so general as to catch any Exception? 

And, if you are suggesting this is catching a NPE, then that doesn't seem quite right ... seems the fix should be "lower" in the code? Why would this not be possible? 


Comment 5 Bradley Childs CLA 2008-05-29 12:28:33 EDT
david  - unfortunately this is one of those "difficult to intentionally reproduce" bugs, and at the moment i can't get it to fail or i would give a more specific answer. so working from my memory...

i believe the NPE is thrown from inside one of the SSE model manager methods.  the only solution for JSDT is to catch it try to recover gracefully. ideally the sse wouldn't throw the NPE.

the catch may be more appropriate deeper inside the javascript translation code, but i felt this was most safe/least impacting solution for now.

to satisfy your concern and tim's as well, i can open a new bug targeted for 3.01 to both better handle and provide proper tracing for NPE's / other errors in this class.
Comment 6 David Williams CLA 2008-05-29 13:52:40 EDT
ok, if it's just "messages in the log", and not that easy to reproduce, I'd prefer to wait rather than put in a "band aid" fix which I think might mask something worse. 

Sounds like it wouldn't hurt that much to leave as is. 

Please correct me if I've misunderstood. 


Comment 7 Nitin Dahyabhai CLA 2008-10-28 14:13:35 EDT
I'd suggest moving this to 3.1 and reopening bug 231878, then.
Comment 8 Bradley Childs CLA 2008-11-25 11:13:59 EST
old/obsolete bug.