Bug 230297 - NPE in LineStyleProviderForJSDT.addJavaTextAttribute()
Summary: NPE in LineStyleProviderForJSDT.addJavaTextAttribute()
Status: VERIFIED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: PMC_approved
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-05-05 16:58 EDT by Chris Jaun CLA
Modified: 2008-06-10 11:30 EDT (History)
2 users (show)

See Also:
david_williams: pmc_approved+
thatnitind: pmc_approved? (raghunathan.srinivasan)
thatnitind: pmc_approved? (naci.dai)
thatnitind: pmc_approved? (deboer)
thatnitind: pmc_approved? (neil.hauge)
thatnitind: pmc_approved? (kaloyan)
thatnitind: review+


Attachments
patch (3.27 KB, patch)
2008-05-06 14:57 EDT, Nick Sandonato CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Jaun CLA 2008-05-05 16:58:58 EDT
Build ID: WTP - I20080424170254

Here is the stack trace when input is set on the editor:

java.lang.NullPointerException at org.eclipse.wst.jsdt.web.ui.internal.style.java.LineStyleProviderForJSDT.addJavaTextAttribute(LineStyleProviderForJSDT.java:143)
	at org.eclipse.wst.jsdt.web.ui.internal.style.java.LineStyleProviderForJSDT.loadColors(LineStyleProviderForJSDT.java:250)
	at org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider.getTextAttributes(AbstractLineStyleProvider.java:182)
	at org.eclipse.wst.jsdt.web.ui.internal.style.java.LineStyleProviderForJSDT.prepareRegions(LineStyleProviderForJSDT.java:260)
	at org.eclipse.wst.sse.ui.internal.rules.StructuredDocumentDamagerRepairer.createPresentation(StructuredDocumentDamagerRepairer.java:48)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.createPresentation(StructuredPresentationReconciler.java:864)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.processDamage(StructuredPresentationReconciler.java:991)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler$InternalListener.textChanged(StructuredPresentationReconciler.java:577)
	at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2647)
	at org.eclipse.jface.text.TextViewer.fireRedrawChanged(TextViewer.java:4684)
	at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4724)
	at org.eclipse.jface.text.TextViewer.enabledRedrawing(TextViewer.java:4692)
	at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4779)
	at org.eclipse.jface.text.TextViewer.setRedraw(TextViewer.java:4751)
	at org.eclipse.jface.text.TextViewer.setVisibleRegion(TextViewer.java:3469)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.setVisibleRegion(ProjectionViewer.java:696)
	at org.eclipse.ui.texteditor.AbstractTextEditor.setHighlightRange(AbstractTextEditor.java:5936)

More information:
Comment 1 Nitin Dahyabhai CLA 2008-05-05 17:29:14 EDT
The LineStyleProvider's been "released" from the ReconcilerHighlighter, but the instance is still being used by the corresponding StructuredDocumentDamagerRepairer, which hasn't been updated.
Comment 2 Nick Sandonato CLA 2008-05-06 14:57:17 EDT
Created attachment 98916 [details]
patch

This problem stemmed from the editor setting its input, and then configuring the viewer. When the viewer was reconfigured, the reconciler highlighter was being uninstalled, but not reinstalled on the new viewer configuration. Additionally, the viewer was not having its presentation reconciler updated to use the one provided by the new viewer configuration.
Comment 3 Nitin Dahyabhai CLA 2008-05-06 17:16:26 EDT
Patch looks good.  In the next release we should review whether the reconciler highlighter is really needed.
Comment 4 Nitin Dahyabhai CLA 2008-05-12 22:41:59 EDT
Actually, Nick take another look at this when you do a Save As on a JSP file containing a JavaScript section.  Something weird happens if you keep inserting near the front of that section.
Comment 5 Nick Sandonato CLA 2008-05-13 13:38:39 EDT
This seems to be a problem that existed before this patch went in. Opened Bug 231878 to address the issue mentioned.
Comment 6 Nitin Dahyabhai CLA 2008-05-14 23:25:01 EDT
Approving because the problem is unrelated.  This is a problem without a workaround whenever input is reset on the editor, something that's supported by superclasses and heavily used in certain adopter product features as well as Save As.  I've tested it as well as Nick, and the risk is low as it now uninstalls the presentation reconciler and installs a fresh new copy when the input is reset.
Comment 7 David Williams CLA 2008-05-15 00:23:34 EDT
Just to clarify ... what is the "bad thing" for the end user? Is it just messages in the log, or does something worse happen. 

Thanks. 

Comment 8 Nick Sandonato CLA 2008-05-15 09:15:33 EDT
(In reply to comment #7)
> Just to clarify ... what is the "bad thing" for the end user? Is it just
> messages in the log, or does something worse happen. 
> 
> Thanks. 
> 

The "bad thing" is not caused by this patch, and has had bug 231878 opened for it. 

What the end user can expect to see is errors in the log, and an incomplete structured text editor, which presents problems like: Smart Insert Mode will be switched off, the source viewer configuration will not be updated (causing syntax highlighting problems among other things), and more errors occur when you try to close the editor.

Hopefully I clarified the right "bad thing".
Comment 9 Nitin Dahyabhai CLA 2008-05-15 17:56:01 EDT
released
Comment 10 Nitin Dahyabhai CLA 2008-05-16 02:40:02 EDT
released
Comment 11 Nick Sandonato CLA 2008-06-10 11:30:22 EDT
Verified in S-3.0RC4-20080610084135.