Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 396035

Summary: [Commands] ExecutionException leads to InjectionException
Product: [Eclipse Project] Platform Reporter: Christian Oelsner <C.Oelsner>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WONTFIX QA Contact: Paul Elder <pelder.eclipse>
Severity: normal    
Priority: P3 CC: Lars.Vogel, pwebster
Version: 4.2.1Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: candidate43

Description Christian Oelsner CLA 2012-12-07 07:16:26 EST
Hello Community,

I don't know if this the right thread to post this bug (wich at least I think it is an annoying issue ;) )

My Problem is the following:
I've created some commands with Handlers (extending the AbstractHandler) ... nothing special about this. The "execute"-Method says I can throw an ExecutionException, which I've done in some of my Handlers. I liked the way Eclipse opened a special MessageDialog to display the Exeception with StackTrace etc.

But now all I get is a:

!ENTRY org.eclipse.ui 4 0 2012-12-07 12:43:25.678
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: org.eclipse.core.commands.ExecutionException: Some reason ... 
  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: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: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)
Cased by: org.eclipse.core.commands.ExecutionException: Some reason .... and so on

I know I could solved this problem by showing a dialog by myself, but I liked the given Eclipse dialog and I don't understand, why this wasn't ported ?! And my opinion is also, that the method allows me to throw an ExecutionException. So why isn't this  handled right ?

I much appreciate any suggestions to solve this problem easy ... 

Cheers!
Christian

PS: Sorry, if I made some mistakes, my english is a bit rusty and this is my first bug report ... so go easy on me, please ;)
Comment 1 Christian Oelsner CLA 2012-12-07 09:56:49 EST
Some details to my configuration:

eclipse.buildId=M20120914-1800
java.version=1.7.0_09-icedtea
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide

Plugin overview says:
org.eclipse.e4.ui.di - 0.10.1.v20120523-1955
Comment 2 Lars Vogel CLA 2012-12-07 11:31:25 EST
Hi Christian,

This behavior in forever in Eclipse 3.x. The Eclipse development for Eclipse 3.x has stopped as the effort has switched Eclipse 4.x.

So I have to close that as won't fix and suggest you have a look at Eclipse4.
Comment 3 Paul Webster CLA 2012-12-07 12:03:39 EST
Should look at the workbench code.

PW
Comment 4 Christian Oelsner CLA 2012-12-07 16:33:39 EST
Hi,

@Lars: Don't get me wrong on this, I don't want to change code within Eclipse 3.x. Actually it worked absolutly charming with Eclipse 3.x (and 4.x !). 

I think all this came with the e4 dependencies of the EMF Plug-ins. This is at least what I've read in the web ?!

And to be honest: Even if this is some "legacy" code, you can't change the way it is processed for many versions, only because you think the latest developments are the best. For me this is the best example for some regressions .... but that's only my opinion and maybe I'm getting the hole thing wrong ...

Oh and the last thing: what I've meant with all the "the method provides exception so it should be handled right" was something like "design by contract". I fulfilled the contract so I want to get my code handled right, not to be thrown only to log ... This has nothing to do with Eclipse version, but with doing what it supposed to be.

Cheers
Christian
Comment 5 Paul Webster CLA 2012-12-10 13:19:45 EST
It's just behaviour that hasn't been ported to the 4.2 Workbench.

PW
Comment 6 Lars Vogel CLA 2014-03-19 22:51:51 EDT
Marking as WONTFIX, we have currently no plans to change the current behavior. Please reopen if you want to contribute a fix for that.