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

NullPointerException in PDEState.querySystemPackages #709

Closed
laeubi opened this issue Aug 16, 2023 · 7 comments · Fixed by #714
Closed

NullPointerException in PDEState.querySystemPackages #709

laeubi opened this issue Aug 16, 2023 · 7 comments · Fixed by #714
Labels
regression Regression defect

Comments

@laeubi
Copy link
Contributor

laeubi commented Aug 16, 2023

I have updates my SDK an now getting NPE

java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:208)
	at java.base/java.lang.String.join(String.java:3320)
	at org.eclipse.pde.internal.build.site.PDEState.querySystemPackages(PDEState.java:548)
	at org.eclipse.pde.internal.build.site.PDEState.getSystemPackages(PDEState.java:491)
	at org.eclipse.pde.internal.core.TargetPlatformHelper.getSystemPackages(TargetPlatformHelper.java:391)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:295)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:243)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.resolveSystemLibrary(ApiBaseline.java:471)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.addApiComponents(ApiBaseline.java:418)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.restoreFrom(ApiBaseline.java:763)
	at org.eclipse.pde.api.tools.internal.ApiBaselineManager.loadBaselineInfos(ApiBaselineManager.java:242)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.loadBaselineInfos(ApiBaseline.java:735)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.getApiComponents(ApiBaseline.java:519)
	at org.eclipse.oomph.setup.pde.impl.APIBaselineFromTargetTaskImpl.isNeeded(APIBaselineFromTargetTaskImpl.java:263)
	at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.initNeededSetupTasks(SetupTaskPerformer.java:2285)
	at org.eclipse.oomph.setup.ui.SetupUIPlugin.performStartup(SetupUIPlugin.java:811)
	at org.eclipse.oomph.setup.ui.SetupUIPlugin$1$1.run(SetupUIPlugin.java:266)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
@laeubi
Copy link
Contributor Author

laeubi commented Aug 16, 2023

I also get now constantly "An internal error occurred during: "Initializing plug-in models".

java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:208)
	at java.base/java.lang.String.join(String.java:3320)
	at org.eclipse.pde.internal.build.site.PDEState.querySystemPackages(PDEState.java:548)
	at org.eclipse.pde.internal.build.site.PDEState.getSystemPackages(PDEState.java:491)
	at org.eclipse.pde.internal.core.TargetPlatformHelper.getSystemPackages(TargetPlatformHelper.java:391)
	at org.eclipse.pde.internal.core.TargetPlatformHelper.addEnvironmentProperties(TargetPlatformHelper.java:378)
	at org.eclipse.pde.internal.core.TargetPlatformHelper.getPlatformProperties(TargetPlatformHelper.java:365)
	at org.eclipse.pde.internal.core.MinimalState.initializePlatformProperties(MinimalState.java:251)
	at org.eclipse.pde.internal.core.PDEState.<init>(PDEState.java:70)
	at org.eclipse.pde.internal.core.PluginModelManager.initializeTable(PluginModelManager.java:617)
	at org.eclipse.pde.internal.core.PluginModelManager.targetReloaded(PluginModelManager.java:542)
	at org.eclipse.pde.internal.core.RequiredPluginsInitializer.lambda$0(RequiredPluginsInitializer.java:33)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:187)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

@HannesWell
Copy link
Member

I have updates my SDK an now getting NPE

Could you please check in which scenario (VMInstall + EE + EE-default) this happen.
Actually the code should handle the null Case so probably another null-check ist sufficient. Could you provide a PR to fix this?

@laeubi
Copy link
Contributor Author

laeubi commented Aug 16, 2023

This happens when a JVM can't be queried for system packages, you can simulate this by having a JDK for an EE and delete the release file, see this bug:

this fixed it on the JDT part but now PDE suffers from this as it somewhere gets a null

also see here why its hard to recover from such state:

@HannesWell
Copy link
Member

Ok. Could please provide a PR with an extra null check?

@HannesWell HannesWell added the regression Regression defect label Aug 17, 2023
@HannesWell
Copy link
Member

I had a quick look at this and while an extra null check would fix the NPE you will likely have follow-up errors because you then have no system-packages provided for that EE and all bundles with that EE that import system-packages will fail to resolve.

So to really fix this all VMs suitable for an EE have to be queried until one returns non-null system packages.
In general it would be good if JDT would sort the VMs of an EE by 'completeness', e.g. by the number of provided system-packages. This would probably also improve the auto-selection used for the VM-Install of an JRE Classpath-container. Then for example the VM contained in Jextract is very unlikely to be used (I had issues once when this happened and all of a sudden many projects failed to compile).

This actually not really a regression from #693 because for modular JDK the same logic was used before.

@jukzi
Copy link
Contributor

jukzi commented Aug 22, 2023

Now i get Warnings on every IDE start. "No JVM system-packages available for environment "
And they are too many. Not even distinct. And why do i get that warnings at all? I did not try to use any 18+ stuff
image

@jukzi jukzi reopened this Aug 22, 2023
@laeubi
Copy link
Contributor Author

laeubi commented Aug 22, 2023

@jukzi I think this is a different issue than the NPE and might better be handled in a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants