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

Bug 334319

Summary: Cannot open editor for unknown content types
Product: [WebTools] WTP Source Editing Reporter: Nick Sandonato <nsand.dev>
Component: wst.sseAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: major    
Priority: P3 CC: david_williams
Version: 3.2.3Flags: david_williams: pmc_approved+
nsand.dev: pmc_approved? (raghunathan.srinivasan)
nsand.dev: pmc_approved? (naci.dai)
nsand.dev: pmc_approved? (deboer)
nsand.dev: pmc_approved? (neil.hauge)
nsand.dev: pmc_approved? (kaloyan)
thatnitind: review+
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Attachments:
Description Flags
patch none

Description Nick Sandonato CLA 2011-01-13 16:08:02 EST
When investigating Bug 334222, I noticed that files opened with a Structured Text Editor that do not have a known content type are unable to open. For example, create an .svg file and force it to open with the XML editor using the Open With... dialog.

java.lang.NullPointerException
	at org.eclipse.wst.sse.ui.StructuredTextEditor$CharacterPairListener.installCompletionListener(StructuredTextEditor.java:865)
	at org.eclipse.wst.sse.ui.StructuredTextEditor.createPartControl(StructuredTextEditor.java:1544)
	at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:241)

While I know we don't really support this method of opening these files without an appropriate content type, we should at least be able to display the text.
Comment 1 Nick Sandonato CLA 2011-01-13 16:08:28 EST
This is also a regression.
Comment 2 Nick Sandonato CLA 2011-01-13 16:17:40 EST
Created attachment 186779 [details]
patch
Comment 3 Nick Sandonato CLA 2011-01-18 12:25:01 EST
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.

This is a regression in terms of opening unsupported content types in the StructuredTextEditor. The editor no longer even displays content.

* Is there a work-around? If so, why do you believe the work-around is insufficient?

No

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

Adhoc testing.

* Give a brief technical overview. Who has reviewed this fix?

The problem is that an unsupported content type is not returning a content assistant facade. During the initialization process, this null facade is generating an NPE causing the editor to open but display the "Error loading editor" message instead of the actual contents of the file. Nitin has reviewed the fix.

* What is the risk associated with this fix?

None. Just needed a null-pointer check.
Comment 4 Nick Sandonato CLA 2011-01-18 13:07:53 EST
Code checked in. Thanks for the quick reviews.