Community
Participate
Working Groups
In our application we have our own SvgEditor (indirectly derived from org.eclipse.ui.part.EditorPart) class that in its initialize method loads an SVG image, and throws an exception (DOMException) when the image is invalid. In Eclipse Indigo, this exception was nicely propagated, and the code that tried to open the editor could catch it. With Eclipse Juno, loading the editor obviously still fails. But now, in WorkbenchPage.busyOpenEditor, local variable compatibilityEditor becomes null, due to the editor failing to load. At the end of that method however, "return compatibilityEditor.getEditor();" is executed, giving a NPE. This is the stack trace for the NPE: java.lang.NullPointerException at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3087) at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:2996) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2978) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2974) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2933) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2916) at nl.tue.common.eclipse.ui.ControlEditor$2.run(ControlEditor.java:199) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3182) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540) 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:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) When the editor fails to load, e4 logs an exception (before getting to the part about the NPE): org.eclipse.e4.core.di.InjectionException: org.w3c.dom.DOMException: invalid.element at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:837) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240) 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:889) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:623) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:725) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:696) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:690) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:675) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:90) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4291) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:57) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:578) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:314) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:962) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3071) at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:2996) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2978) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2974) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2933) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2916) at nl.tue.common.eclipse.ui.ControlEditor$2.run(ControlEditor.java:199) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3182) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540) 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:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) Caused by: org.w3c.dom.DOMException: invalid.element at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source) at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(Unknown Source) at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at nl.tue.cif.v2x1x1.simulator.outputs.svg.SvgEditor.initialize(SvgEditor.java:131) at nl.tue.common.eclipse.ui.ControlEditor.init(ControlEditor.java:61) at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:324) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) ... 75 more Somehow the exception is not forwarded, but logged, resulting in the code to continue, and thus resulting in the NPE. I use: Eclipse Modeling Tools, Version: Juno Release, Build id: 20120620-1657
Created attachment 220922 [details] Error Log Entry The error that comes up when opening a (review) task from a Sonar Task Repository.
(In reply to comment #1) > Created attachment 220922 [details] > Error Log Entry > > The error that comes up when opening a (review) task from a Sonar Task > Repository. I have found that I have the pretty same first 7 stack frames when using Mylyn with a Sonar Task Repository. All I do is trying to open a (review) task. For now, I don't know which information I should provide additionally. If there's any, please let me know.
Dennis, what did you used to get back when it failed (Guessing 'null') ?
(In reply to comment #3) > Dennis, what did you used to get back when it failed (Guessing 'null') ? I don't think I used to get anything back, as I got an exception, not a 'normal' return from the method. As such, there was no value to get back, only the exception. Note that this is what I wanted, so that the code calling the 'openEditor' method (which is my own application code) could catch such exceptions, and handle them properly.
(In reply to comment #4) > (In reply to comment #3) > > Dennis, what did you used to get back when it failed (Guessing 'null') ? > > I don't think I used to get anything back, as I got an exception, not a > 'normal' return from the method. As such, there was no value to get back, > only the exception. Note that this is what I wanted, so that the code > calling the 'openEditor' method (which is my own application code) could > catch such exceptions, and handle them properly. Looking at the code more closely, I think it is a bit more complicated. I catch org.eclipse.ui.PartInitException, but also check the result from the 'openEditor' method, to make sure it is not an instance of org.eclipse.ui.internal.ErrorEditorPart. So, from that I think we can conclude that in Indigo, either a PartInitException was thrown, or an ErrorEditorPart was returned. I had an explicit assertion that made sure the result was not 'null', so I think we can safely assume that 'null' was never returned.
Dennis, thanks for the info. Just for completeness what do you get on 3.x (exception + ErrorPart) ?
(In reply to comment #6) > Dennis, thanks for the info. Just for completeness what do you get on 3.x > (exception + ErrorPart) ? I was describing Eclipse 3.7.2 in comment #4 and comment #5. As stated in comment #5, "either a PartInitException was thrown, or an ErrorEditorPart was returned." Obviously, if an exception is thrown, the method does not return normally, and nothing is returned (not even 'null' or ErrorEditorPart).
I don't think we can support this in 4.x -- it certainly was never documented behaviour, and our new E4 structure makes it impossible without some significant refactoring. The problem on 4.2 is that part creation is performed as part of an injection-based object creation. Unhandled exceptions occurring during this injection are turned by the JVM into InvocationTargetExceptions which are trapped by the injector (specifically MethodRequestor) and converted to InjectionExceptions. The ReflectionContributionFactory, used to create contributed objects, (rightly) treats InjectionExceptions as a failure to create the object. Even if that could be circumvented, there's a bigger problem in that the part is created via a series of triggered events. There's actually no guarantee that the part is created during the call into openEditor / showView. Thread [main] (Suspended (exception RuntimeException)) CompatibilityEditor(CompatibilityPart).create() line: 300 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 MethodRequestor.execute() line: 56 InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 861 InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 841 InjectorImpl.inject(Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 113 InjectorImpl.internalMake(Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 321 InjectorImpl.make(Class<T>, PrimaryObjectSupplier) line: 242 ContextInjectionFactory.make(Class<T>, IEclipseContext) line: 161 ReflectionContributionFactory.createFromBundle(Bundle, IEclipseContext, IEclipseContext, URI) line: 102 ReflectionContributionFactory.doCreate(String, IEclipseContext, IEclipseContext) line: 71 ReflectionContributionFactory.create(String, IEclipseContext) line: 53 ContributedPartRenderer.createWidget(MUIElement, Object) line: 141 PartRenderingEngine.createWidget(MUIElement, Object) line: 892 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 627 PartRenderingEngine.safeCreateGui(MUIElement) line: 729 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 700 PartRenderingEngine$7.run() line: 694 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 679 PartServiceImpl$1.handleEvent(Event) line: 92 UIEventHandler$1.run() line: 41 UISynchronizer(Synchronizer).syncExec(Runnable) line: 180 UISynchronizer.syncExec(Runnable) line: 150 Display.syncExec(Runnable) line: 4299 E4Application$1.syncExec(Runnable) line: 187 UIEventHandler.handleEvent(Event) line: 38 EventHandlerWrapper.handleEvent(Event, Permission) line: 197 EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1 EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 230 ListenerQueue.dispatchEventSynchronous(int, Object) line: 148 EventAdminImpl.dispatchEvent(Event, boolean) line: 135 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 80 UIEventPublisher.notifyChanged(Notification) line: 58 PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 374 PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 171 ModelServiceImpl.showElementInWindow(MWindow, MUIElement) line: 418 ModelServiceImpl.bringToTop(MUIElement) line: 385 PartServiceImpl.delegateBringToTop(MPart) line: 591 PartServiceImpl.bringToTop(MPart) line: 317 PartServiceImpl.showPart(MPart, EPartService$PartState) line: 997 WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento, boolean) line: 3096 WorkbenchPage.access$22(WorkbenchPage, IEditorInput, String, boolean, int, IMemento, boolean) line: 3020 WorkbenchPage$8.run() line: 3002 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento, boolean) line: 2998 WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2962 WorkbenchPage.openEditor(IEditorInput, String) line: 2945 NewEditorHandler.execute(ExecutionEvent) line: 107 HandlerProxy.execute(ExecutionEvent) line: 290 E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 76
Created attachment 225165 [details] Test project to show the NullPointerException This is a test project to show the NullPointerException. From 'Sample Menu', select the 'Sample Command'. Observe how an editor is successfully opened, with title 'crash: false'. The other editor fails to open. Log output: [code] bug387475test.handlers.TestEditor@1e640d2 !ENTRY org.eclipse.e4.ui.workbench 4 0 2013-01-03 11:30:29.856 !MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from bundle '730' !STACK 0 org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException: Crashed! at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:839) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240) 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:896) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1114) at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:67) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4291) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:579) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:558) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:532) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:521) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:983) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3079) at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:3003) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2985) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2981) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2940) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2923) at bug387475test.handlers.Bug387475TestCommand.test(Bug387475TestCommand.java:38) at bug387475test.handlers.Bug387475TestCommand.execute(Bug387475TestCommand.java:25) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:814) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:707) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:691) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:630) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3554) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3179) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) 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:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) Caused by: java.lang.IllegalArgumentException: Crashed! at bug387475test.handlers.TestEditor.init(TestEditor.java:26) at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:324) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) ... 94 more !ENTRY org.eclipse.ui 4 0 2013-01-03 11:30:29.870 !MESSAGE Unhandled event loop exception !STACK 0 org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:814) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:707) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:691) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:630) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3554) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3179) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) 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:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) Caused by: java.lang.NullPointerException at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3095) at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:3003) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2985) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2981) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2940) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2923) at bug387475test.handlers.Bug387475TestCommand.test(Bug387475TestCommand.java:38) at bug387475test.handlers.Bug387475TestCommand.execute(Bug387475TestCommand.java:25) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) ... 34 more [/code] The last error (!MESSAGE Unhandled event loop exception / !STACK 0 / org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException) is the reason I created this bugzilla. This is what I asked to be fixed, as openEditor should not result in a NullPointerException.
Created attachment 225199 [details] 2nd test project: difference between exception in 'init' and 'createPartControl' Attachment 'bug387475test-v2.zip' is an extension of 'bug387475test.zip', to show the difference between an exception thrown in the 'init' method of the editor part, and the 'createPartControl' method. In the 'init' method, an exception results in a NullPointerException, and things crash. In the 'createPartControl', exceptions cause the editor to fail to load. An instance of org.eclipse.ui.internal.ErrorEditorPart is created instead. This error editor shows up in Eclipse, and shows the exception that caused it. The showEditor method returns normally, with the ErrorEditorPart instance as result. I'm not sure why, but there is a difference in the handling of exceptions for the 'init' and 'createPartControl' methods. Perhaps the 'init' method exceptions could be handled in a way similar to the 'createPartControl' exceptions? (see attachment 'bug387475test-v2-output.txt' for the output of this second test project)
Created attachment 225200 [details] Output of the 2nd test project (bug387475test-v2.zip) Output I get when running the command from the 2nd test project (bug387475test-v2.zip).
NB: the same problem happens with an exception during the creation of a ViewPart
At minimum we should be doing *something" besides NPE'ing, perhaps re-throwing a PartInitException ?
Daniel, can you look at this one (I believe you were recently solving another bug in this area)? If I run the test plugin v2 I get a part (good) and error part (good) and a blank editor and an NPE in busyOpenEditor (not so good) PW
Submitted with - http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4a6de6d78ccddd12357a9e0b6a06cc22c1fcab6d
Verified in the build I20130428-2000
*** Bug 409794 has been marked as a duplicate of this bug. ***
*** Bug 403754 has been marked as a duplicate of this bug. ***