Project: Eclipse_Platform_UI
Bug 376269 Editor Mapping Lookup in EditorRegistry assume file extension is not empty
Reported: 2012-04-06 20:16:04 | Status: verified fixed

Build Identifier: M20120208-0800 Some background: We have an existing editor associated to the file names BUILD and BUILD.test. We are currently re-writing this editor. Until this new editor has all the features of the existing/old one, we are allowing our users to use both, for testing purposes. The problem is that when they install the new one, "BUILD" is not mapped to the new editor, even though the new editor is associated to the file names BUILD and BUILD.test. BTW, the new editor is successfully mapped to BUILD.test (but not to BUILD). Problem: After doing some debugging, we found out that the method readResources(Map, Reader) in org.eclipse.ui.internal.registry.EditorRegistry assumes that the file extension is never empty: FileEditorMapping mapping = getMappingFor(name + "." + extension); //$NON-NLS-1$ I'm submitting a patch that does the following, instead: String key = name; if (extension != null && extension.length() > 0) { key = key + "." + extension; //$NON-NLS-1$ } FileEditorMapping mapping = getMappingFor(key); This bug is present in 3.7.2, 3.8 and Juno. The same patch can be be applied to all the Eclipse versions. Reproducible: Always Steps to Reproduce: 1. Have an editor associated to a file name without extension (e.g. "BUILD") 2. Create a new plug-in that has an editor associated to the same extension 3. When the new editor is installed, it is not associated to the file name it is supposed to.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java