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

Bug 312145

Summary: "Semantic Highlighting Job" gets NPE
Product: [WebTools] WTP Source Editing Reporter: Zhongwei Zhao <zhaozhongwei>
Component: wst.sseAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: nsand.dev
Version: unspecifiedFlags: thatnitind: review+
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 312099    
Attachments:
Description Flags
patch none

Description Zhongwei Zhao CLA 2010-05-07 21:58:39 EDT
There is a user said

When I open a PHP file, a "Semantic Highlighting Job" task appears in the Progress view (if I have "Show sleeping and system operations" turned on).

If I close the file before the job has completed, I get that error. If I wait for the job to complete, I don't.

It doesn't seem to depend on the file's content.


here is the stackprace:

java.lang.NullPointerException
at org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler.addPosition(SemanticHighlightingReconciler.java:184)
at org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler.addPosition(SemanticHighlightingReconciler.java:166)
at org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler.reconcile(SemanticHighlightingReconciler.java:129)
at org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler$1.run(SemanticHighlightingReconciler.java:279)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


I think here should synchronized the block and then judge if fPresenter is null.
Comment 1 Nick Sandonato CLA 2010-05-12 17:36:37 EDT
Created attachment 168278 [details]
patch

Cleans up the code to use the fJob* fields as was intended. Also added was some extra checks to make sure we don't continue processing regions after the reconciler's been uninstalled.
Comment 2 Nick Sandonato CLA 2010-05-12 17:38:08 EDT
Nitin, could you review this for RC1? I think the reconciler running after the editor's been shutdown is a performance drag and we should also clean up this NPE to prevent unnecessary log messages.
Comment 3 Nick Sandonato CLA 2010-05-12 21:32:58 EDT
Code checked in for RC1.