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

Prevent NPE on Missing/Invalid Java Platform #7341

Conversation

lkishalmi
Copy link
Contributor

In the hopefully rare case, when a JDK got removed from the system between Gradle project reloads, platform can go invalid and an attempted registration throws an NPE at:

java.lang.NullPointerException: The installFolder parameter cannot be null
	at org.openide.util.Parameters.notNull(Parameters.java:64)
	at org.netbeans.modules.java.j2seplatform.platformdefinition.J2SEPlatformFactory.create(J2SEPlatformFactory.java:51)
	at org.netbeans.modules.gradle.java.spi.support.JavaToolchainSupport.detectPlatform(JavaToolchainSupport.java:87)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228)
	at org.netbeans.modules.gradle.java.spi.support.JavaToolchainSupport.platformByHome(JavaToolchainSupport.java:70)
	at org.netbeans.modules.gradle.java.classpath.BootClassPathImpl.createPath(BootClassPathImpl.java:59)
	at org.netbeans.modules.gradle.java.classpath.AbstractGradleClassPathImpl.getResources(AbstractGradleClassPathImpl.java:108)
	at org.netbeans.api.java.classpath.ClassPath.entries(ClassPath.java:363)
	

@lkishalmi lkishalmi added the Gradle [ci] enable "build tools" tests label Apr 28, 2024
@lkishalmi lkishalmi added this to the NB22 milestone Apr 28, 2024
@lkishalmi lkishalmi force-pushed the gradle-prevent-npe-on-missing-java-toolchain branch from 3672e67 to e4bf76d Compare April 29, 2024 02:54
@lkishalmi lkishalmi requested a review from mbien April 29, 2024 02:57
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

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

code looks good. Haven't tested it though.

@ebarboni ebarboni merged commit c415fad into apache:delivery Apr 29, 2024
34 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants