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

Avoid NPE on null value in list/map/property. #5868

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

sdedic
Copy link
Member

@sdedic sdedic commented Apr 21, 2023

On some projects, like micronaut-liquidbase, the IDE reports an exception during project load and fails to load the project properly:

Reason: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "v" is null
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "v" is null
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.dumpContainerProperties(NbProjectInfoBuilder.java:737)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.inspectExtensions(NbProjectInfoBuilder.java:894)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.detectExtensions(NbProjectInfoBuilder.java:440)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.lambda$runAndRegisterPerf$9(NbProjectInfoBuilder.java:413)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.runAndRegisterPerf(NbProjectInfoBuilder.java:419)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.runAndRegisterPerf(NbProjectInfoBuilder.java:413)
	at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.lambda$buildAll$3(NbProjectInfoBuilder.java:227)

This PR changes the places that serialize map/list/property values and only recurses on non-null values, writes safely nulls.

@sdedic sdedic added kind:bug Bug report or fix Gradle [ci] enable "build tools" tests VSCode Extension [ci] enable VSCode Extension tests labels Apr 21, 2023
@sdedic sdedic added this to the NB18 milestone Apr 21, 2023
@sdedic sdedic self-assigned this Apr 21, 2023
@sdedic sdedic added the priority:high High priority issue that should, if possible, be fixed in next release label Apr 21, 2023
Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Ok. Thanks!

@neilcsmith-net neilcsmith-net merged commit 9aa35b2 into apache:delivery Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gradle [ci] enable "build tools" tests kind:bug Bug report or fix priority:high High priority issue that should, if possible, be fixed in next release VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants