Check valid properties for channel#5416
Merged
holgerfriedrich merged 1 commit intoopenhab:mainfrom Mar 15, 2026
Merged
Conversation
adbf540 to
fd7be1c
Compare
There was a problem hiding this comment.
Pull request overview
Fixes intermittent NullPointerException when serializing Things for MainUI by ensuring Channel properties do not contain null values before they reach Channel#getProperties() (which uses Map.copyOf).
Changes:
- Filter out channel properties with null values inside
ChannelBuilder.withProperties(...)and log a warning when this occurs. - Add a unit test covering behavior when null-valued properties are provided.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/ChannelBuilder.java | Sanitizes channel property maps by ignoring entries with null values and emitting a warning. |
| bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java | Adds a regression test verifying null-valued properties are dropped. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
....openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/ChannelBuilder.java
Outdated
Show resolved
Hide resolved
....openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/ChannelBuilder.java
Outdated
Show resolved
Hide resolved
...nhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java
Outdated
Show resolved
Hide resolved
jlaur
reviewed
Mar 13, 2026
....openhab.core.thing/src/main/java/org/openhab/core/thing/binding/builder/ChannelBuilder.java
Outdated
Show resolved
Hide resolved
fd7be1c to
e75217b
Compare
Null key or value are rejected and an IllegalArgumentException is thrown. Fix openhab#5278 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
e75217b to
a75ac9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Null key or value are rejected and an IllegalArgumentException is thrown.
Fix #5278