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

Fix NPE by executing JavaSearchStartupParticipant.start() in Display.getCurrent() #6219

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

chrisrueger
Copy link
Contributor

@chrisrueger chrisrueger commented Aug 17, 2024

Closes #6199

This hopefully fixes the NPE in org.eclipse.jface.resource.JFaceResources.getResources(Display) which expects the current display

For the record: I did not do the same in JavaSearchStartupParticipant.stop() because then I got the following when exiting the Debug Eclipse instance:

g! 2024-08-17 13:06:01,117 [Framework stop - Equinox Container: 08c6cf07-37df-4845-b378-a729e987b66a] ERROR org.eclipse.equinox.logger - Error stopping startup participant
java.lang.NullPointerException: Cannot invoke "org.eclipse.swt.widgets.Display.syncExec(java.lang.Runnable)" because the return value of "org.eclipse.swt.widgets.Display.getCurrent()" is null
	at bndtools.javasearch.JavaSearchStartupParticipant.stop(JavaSearchStartupParticipant.java:51)
	at bndtools.Plugin.stopStartupParticipants(Plugin.java:124)
	at bndtools.Plugin.stop(Plugin.java:139)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:875)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:867)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:1046)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:376)
	at org.eclipse.osgi.container.Module.doStop(Module.java:660)
	at org.eclipse.osgi.container.Module.stop(Module.java:521)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1893)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1768)
	at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:275)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:208)
	at org.eclipse.osgi.container.Module.doStop(Module.java:660)
	at org.eclipse.osgi.container.Module.stop(Module.java:521)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:207)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:226)
	at java.base/java.lang.Thread.run(Thread.java:1583)

So I left JavaSearchStartupParticipant.stop() unchanged.

This hopefully fixes the NPE in org.eclipse.jface.resource.JFaceResources.getResources(Display) which expects the current display
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

The change is based on our discussion yesterday in bnd call. We agreed to just merge it to master and try the next snapshot if it fixes the problem.

@chrisrueger chrisrueger merged commit 3c005d4 into bndtools:master Aug 17, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eclipse 2024-06 Error when installing with bndtools m2e
1 participant