Skip to content

Check valid properties for channel#5416

Merged
holgerfriedrich merged 1 commit intoopenhab:mainfrom
lolodomo:channel_null_properties
Mar 15, 2026
Merged

Check valid properties for channel#5416
holgerfriedrich merged 1 commit intoopenhab:mainfrom
lolodomo:channel_null_properties

Conversation

@lolodomo
Copy link
Copy Markdown
Contributor

@lolodomo lolodomo commented Mar 11, 2026

Null key or value are rejected and an IllegalArgumentException is thrown.

Fix #5278

@lolodomo lolodomo requested a review from a team as a code owner March 11, 2026 13:01
@lolodomo lolodomo force-pushed the channel_null_properties branch from adbf540 to fd7be1c Compare March 11, 2026 19:54
@wborn wborn requested a review from Copilot March 12, 2026 08:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@lolodomo lolodomo force-pushed the channel_null_properties branch from fd7be1c to e75217b Compare March 13, 2026 20:42
@lolodomo lolodomo changed the title Ignore null properties for channel Check valid properties for channel Mar 13, 2026
Null key or value are rejected and an IllegalArgumentException is thrown.

Fix openhab#5278

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo force-pushed the channel_null_properties branch from e75217b to a75ac9d Compare March 13, 2026 20:50
Copy link
Copy Markdown
Member

@holgerfriedrich holgerfriedrich left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@holgerfriedrich holgerfriedrich merged commit abdda02 into openhab:main Mar 15, 2026
5 checks passed
@holgerfriedrich holgerfriedrich added the enhancement An enhancement or new feature of the Core label Mar 15, 2026
@holgerfriedrich holgerfriedrich added this to the 5.2 milestone Mar 15, 2026
@lolodomo lolodomo deleted the channel_null_properties branch March 15, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature of the Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointerException when requesting Things for MainUI

4 participants