Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e4: FinishedJobs instance is never injected into ProgressServiceImpl for progress dialogs #1887

Closed
selundqma opened this issue May 14, 2024 · 3 comments · Fixed by #1888
Closed
Labels
bug Something isn't working

Comments

@selundqma
Copy link
Contributor

selundqma commented May 14, 2024

My progress monitor dialog throws a NPE when cancelling a sub job in the details view (the red button). I have traced the issue down to the ProgressServiceImpl class where the finishedJobs variable isn´t injected, thus is always null. I tried to download the code from GitHub and use it instead of the plugin in Eclipse 2024-03 (4.31) and by removing the row with @Optional, it suddenly worked just fine.

@Inject
FinishedJobs finishedJobs;

Stack trace:
java.lang.NullPointerException: Cannot invoke "org.eclipse.e4.ui.progress.internal.FinishedJobs.isKept(org.eclipse.e4.ui.progress.internal.JobTreeElement)" because "this.finishedJobs" is null
at org.eclipse.e4.ui.progress.internal.ProgressInfoItem.cancelOrRemove(ProgressInfoItem.java:308)
at org.eclipse.e4.ui.progress.internal.ProgressInfoItem$1.widgetSelected(ProgressInfoItem.java:229)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:165)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
at org.eclipse.equinox.launcher.Main.main(Main.java:1432)

image

I also tried to add a ProgressView to my application to get the jobs listed there. And that works just fine. Probably due to the correctly injected FinishedJobs instance in the view´s createPartControl method (which doesn´t use the @Optional annotation.

@selundqma selundqma added the bug Something isn't working label May 14, 2024
@jukzi jukzi changed the title FinishedJobs instance is never injected into ProgressServiceImpl for progress dialogs e4: FinishedJobs instance is never injected into ProgressServiceImpl for progress dialogs May 15, 2024
@jukzi
Copy link
Contributor

jukzi commented May 15, 2024

@selundqma there a no active maintainers for e4. Can you provide a test & bugfix?

@selundqma
Copy link
Contributor Author

Hi @jukzi ! Sure, the fix I proposed in the initial text should do the trick. I would have to see how to provide a test for it. Any idea what to think about there? Then.. do I have to become a Commiter in this project to be able to fork, pull, create PR and submit?

@jukzi
Copy link
Contributor

jukzi commented May 15, 2024

Please see https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md
You can suggest a Pull Request without being committer. A committer may review and apply the fix. Only If you contribute regular you may be gain committer status.
Just removing @Optional may be wrong for other use cases.

selundqma added a commit to selundqma/eclipse.platform.ui that referenced this issue May 15, 2024
…platform#1887

The "finishedJobs" variable isn´t injected, thus is always null, when used
from a progress dialog. Since the @optional field in combination with @Inject
only refers to already created instances of FinishedJobs. But, this does
not happen in this flow.

Fixes eclipse-platform#1887
fedejeanne pushed a commit to selundqma/eclipse.platform.ui that referenced this issue Jun 3, 2024
…platform#1887

The "finishedJobs" variable isn´t injected, thus is always null, when used
from a progress dialog. Since the @optional field in combination with @Inject
only refers to already created instances of FinishedJobs. But, this does
not happen in this flow.

Fixes eclipse-platform#1887
fedejeanne pushed a commit that referenced this issue Jun 3, 2024
The "finishedJobs" variable isn´t injected, thus is always null, when used
from a progress dialog. Since the @optional field in combination with @Inject
only refers to already created instances of FinishedJobs. But, this does
not happen in this flow.

Fixes #1887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants