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 possible NPE in Tiny.java #5249

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Conversation

lkishalmi
Copy link
Contributor

Well, I've bumped into this one today:

java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because "type" is null
	at org.netbeans.modules.java.hints.perf.Tiny.getDestinationType(Tiny.java:537)
	at org.netbeans.modules.java.hints.perf.Tiny.unnecessaryTempFromString(Tiny.java:488)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

This is a trivial patch for that. I've checked the invocations of resolveType(...) it seems that the return value is checked for null at other places.

@lkishalmi lkishalmi added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Jan 9, 2023
@lkishalmi lkishalmi added this to the NB17 milestone Jan 9, 2023
@lkishalmi lkishalmi requested a review from mbien January 9, 2023 06:29
@mbien mbien added the hints label Jan 9, 2023
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.

thanks for fixing my code :)

@lkishalmi lkishalmi merged commit dea562a into apache:master Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hints Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants