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 in GroupStateTriggerHandler and GroupCommandTriggerHandler #3966

Merged
merged 2 commits into from
Dec 27, 2023

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Dec 27, 2023

Reported on the community forum. The handler checks if the item's group names contains the configured value. A null group name results in the NPW during that check.

Reported on the community forum. The handler checks if the item's group names contains the configured value. A `null` group name results in the NPW during that check.

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K added the bug An unexpected problem or unintended behavior of the Core label Dec 27, 2023
@J-N-K J-N-K requested a review from a team as a code owner December 27, 2023 12:04
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-4-1-release-discussion/152252/76

Copy link
Member

@wborn wborn 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 the fix!
Maybe it is also easy to add unit tests for this?

@J-N-K
Copy link
Member Author

J-N-K commented Dec 27, 2023

What should be covered by that test? The "real" problem is that we don't validate the trigger configurations before we create the modules.

@wborn
Copy link
Member

wborn commented Dec 27, 2023

What should be covered by that test?

Based on the changes the tests could check that a warning is logged whenever the groupName is missing and no NPE is thrown when the receive method is called.
Then if someone in the future removes the check or messes up the logic the tests would fail.

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K
Copy link
Member Author

J-N-K commented Dec 27, 2023

Done

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

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

Thanks!

@wborn wborn merged commit bb7a0da into openhab:main Dec 27, 2023
3 checks passed
@wborn wborn added this to the 4.2 milestone Dec 27, 2023
@J-N-K J-N-K deleted the npe-grouptriggerhandler branch December 27, 2023 22:42
@lolodomo
Copy link
Contributor

@J-N-K : is it something to backport in branch 4.1.x ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants