Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334319 - Cannot open editor for unknown content types
Summary: Cannot open editor for unknown content types
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 3.2.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.2.3   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-13 16:08 EST by Nick Sandonato CLA
Modified: 2011-01-27 13:05 EST (History)
1 user (show)

See Also:
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+


Attachments
patch (2.23 KB, patch)
2011-01-13 16:17 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.