Bug 400714 - Replace deprecated API usage in WorkbenchPlugin#createExtension
Summary: Replace deprecated API usage in WorkbenchPlugin#createExtension
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2013-02-13 12:04 EST by Lars Vogel CLA
Modified: 2013-03-12 11:25 EDT (History)
3 users (show)

See Also:


Attachments
Patch (924 bytes, patch)
2013-02-13 12:04 EST, Lars Vogel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2013-02-13 12:04:11 EST
Created attachment 227030 [details]
Patch

WorkbenchPlugin give me a NPE in N20130202-2000. See below for the stacktrace.

This might be related to the usage of deprecated API. Patch to fix this usage attached.



org.eclipse.core.runtime.CoreException: Cannot create extension
	at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:287)
	at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:319)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:262)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:61)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:299)
	at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:861)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:841)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:113)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:321)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:242)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:893)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:627)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:729)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:700)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:694)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:679)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.createElement(PartServiceImpl.java:1071)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1033)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:464)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:269)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2999)
	at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:2969)
	at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2951)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2947)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2911)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2902)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:655)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:614)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:268)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:233)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:47)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3705)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3326)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1057)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:941)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:79)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
	... 84 more
Comment 1 Dani Megert CLA 2013-02-14 03:47:31 EST
What are the steps to trigger the NPE?
Comment 2 Lars Vogel CLA 2013-02-14 04:13:11 EST
Happens to me if I start Eclipse and the Eclipse IDE tries to open an XML editor. If I select the same file and right-click on it-> Open with -> XML editor it works.

Also I get this frequently if I navigate with F3 between XML files.
Comment 3 Lars Vogel CLA 2013-02-14 04:14:02 EST
@Dani: I think the deprecated API access should be replaced in any case. Once we use the correct API I can debug this.
Comment 4 Dani Megert CLA 2013-02-14 06:27:41 EST
(In reply to comment #3)
> @Dani: I think the deprecated API access should be replaced in any case.

Sure, but that's not related to this bug. According to the API - even if deprecated - 'null' is not a valid return value. Assuming that, I suspect that 'element' is 'null' and your patch would simply produce the same NPE.

I'm not able to reproduce the problem with the XML editor from the eclipse-java-juno-SR1-win32 package.
Comment 5 Lars Vogel CLA 2013-02-14 07:05:12 EST
@Dani: my Eclipse IDE build is N20130202-2000 and not SR1 (see Comment 1).
Comment 6 Dani Megert CLA 2013-02-14 07:34:41 EST
(In reply to comment #5)
> @Dani: my Eclipse IDE build is N20130202-2000 and not SR1 (see Comment 1).

I could not find such a build but used N20130203-2000 instead:

1. install the build
3. start with new workspace
4. install 'Eclipse XML Editors and Tools' (requires restart)
5. add some XML files
6. close and reopen
6. restart
7. close and reopen the files
==> no NPEs

So, either you're using different steps, or something else is broken in your install/workspace.
Comment 7 Lars Vogel CLA 2013-02-14 12:23:01 EST
Thanks Dani, I downloaded the night build from yesterday and this error does not occur anymore. I assume it is related to you reexporting the resource plug-in again. 

I suggest to still fix the deprecated access.
Comment 8 Dani Megert CLA 2013-02-15 03:48:23 EST
Added credentials and pushed patch with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8d7e0388bce812c63b73903d18c6022c519c74d9
Comment 9 Paul Elder CLA 2013-03-12 11:25:31 EDT
Verified in 4.3.0.I20130311-2000