| Summary: | [EditorMgmt] NPE changing default file association | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jared Burns <jared_burns> | ||||
| Component: | UI | Assignee: | Andrey Loskutov <loskutov> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Andrei.Pozolotin, eclipse, loskutov, trevor | ||||
| Version: | 3.1 | ||||||
| Target Milestone: | 4.7 M1 | ||||||
| Hardware: | PC | ||||||
| OS: | All | ||||||
| See Also: |
https://git.eclipse.org/r/74351 https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=de87d4bf278f2eb79b43f63e0a8ae6c50cb05514 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Jared Burns
Kim: Do you have any ideas about this? Perhaps changes recently that might have set this off? The problem appears to happen if a null editor descriptor can get set through the FileEditorMapping.setDefaultEditor(EditorDescriptor) method. I also hit this bug in I20050627-1435 (3.1). I got it when adding some associations, and also when simply making an existing association the default. The NPE occurs when clicking OK. The changes do seem to take effect anyway. Moving Dougs bugs Remy is now responsible for watching the [EditorMgmt] component area. started to happen again: java.lang.NullPointerException at org.eclipse.ui.internal.registry.EditorRegistry.addExternalEditorsToEditorMap(EditorRegistry.java:292) at org.eclipse.ui.internal.registry.EditorRegistry.rebuildEditorMap(EditorRegistry.java:981) at org.eclipse.ui.internal.registry.EditorRegistry.setFileEditorMappings(EditorRegistry.java:1129) at org.eclipse.ui.internal.dialogs.FileEditorsPreferencePage.performOk(FileEditorsPreferencePage.java:506) at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:925) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173) at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:909) at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:409) at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.okPressed(WorkbenchPreferenceDialog.java:168) at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:233) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3819) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3430) at org.eclipse.jface.window.Window.runEventLoop(Window.java:827) at org.eclipse.jface.window.Window.open(Window.java:803) at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211) at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:63) at org.eclipse.jface.action.Action.runWithEvent(Action.java:473) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3819) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3430) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608) at org.eclipse.equinox.launcher.Main.run(Main.java:1515) at org.eclipse.equinox.launcher.Main.main(Main.java:1488) eclipse.buildId=4.5.2.M20160212-1500 java.version=1.8.0_77 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product -clean (In reply to Andrei Pozolotin from comment #6) > started to happen again: Steps to reproduce? (In reply to Andrey Loskutov from comment #7) > (In reply to Andrei Pozolotin from comment #6) > > started to happen again: > > Steps to reproduce? Please with Neon (4.6) RC. steps to reproduce:
1) navigate
Window -> Preferences -> General -> Editors -> File Associations
2) select
File types: Add -> "*.tester"
Associated editors: Add -> "Properties File Editor"
3) click OK
now error log consistently shows same exception:
java.lang.NullPointerException
at org.eclipse.ui.internal.registry.EditorRegistry.addExternalEditorsToEditorMap(EditorRegistry.java:292)
the association works during current session, and is lost upon eclipse restart
the persistence file
data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
does not show any changes in content or time stamp
I think this started to happen after upgrade to eclipse.buildId=4.5.2.M20160212-1500
work around: manually add required entries to *.prefs data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs for example <info extension\="service" name\="*">\n<editor id\="org.eclipse.jdt.ui.PropertiesFileEditor"/>\n</info>\n (In reply to Andrei Pozolotin from comment #10) > source > > https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org. > eclipse.ui.workbench/Eclipse%20UI/org/eclipse/ui/internal/registry/ > EditorRegistry.java#n270 Andrei, can you please grab 4.6 RC3 from http://download.eclipse.org/eclipse/downloads/drops4/S-4.6RC3-201605252000/ and try to reproduce your issue with it? The source you've referring to is evolved and the stack doesn't match to the code. ok, will do test result: the exception is gone with eclipse-jee-neon-RC2-linux-gtk-x86_64.tar.gz (and whole workspace/prefs migrated 4.5 -> 4.6 on start) (In reply to Andrei Pozolotin from comment #14) > test result: > the exception is gone with > eclipse-jee-neon-RC2-linux-gtk-x86_64.tar.gz > (and whole workspace/prefs migrated 4.5 -> 4.6 on start) Strange. I hoped to get a fresh stack trace. Anyway, the old stack was referring to this code in EditorRegistry: FileEditorMapping map = maps[i]; IEditorDescriptor[] descArray = map.getEditors(); for (int n = 0; n < descArray.length; n++) { desc = descArray[n]; mapIDtoEditor.put(desc.getId(), desc); // <-- NPE here } The code is still same in head, so I will put some guards into FileEditorMapping which allows today adding "null" editors. New Gerrit change created: https://git.eclipse.org/r/74351 tested few more times, it is reproducible: 1) exception is thrown in: Version: Mars.2 Release (4.5.2) Build id: 20160218-0600 2) exception is not present in: Version: Neon Release Candidate 2 (4.6.0RC2) Build id: 20160526-1324 there is also new "suspicious" :-) behavior in 4.6: when you type in dialog (first time after start): "Add File Type : Define a New File Type" there is a visible delay; probably some cache/search function? Created attachment 262202 [details]
data/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
this is the org.eclipse.ui.workbench.prefs which consistently produces exception;
may be the file itself content gets corrupt as so to produce "null" editors?
more mystery: the diff on org.eclipse.ui.workbench.prefs in 4.5 vs 4.6 worksapce shows the files are the same (In reply to Andrei Pozolotin from comment #19) > more mystery: the diff on > org.eclipse.ui.workbench.prefs > in 4.5 vs 4.6 worksapce shows the files are the same OK, let assume this was fixed in 4.6. Thanks for testing, and feel free to reopen this bug if you will find a way to reproduce it on 4.6+. BTW, because 4.6 is closed for fixes now, I will push the remaining gerrit patch to 4.7 and close the bug. great, thank you. Gerrit change https://git.eclipse.org/r/74351 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=de87d4bf278f2eb79b43f63e0a8ae6c50cb05514 |