Skip to content

Refactor to avoid possible null pointer dereference in YamlModelRepositoryImpl #4788

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

Merged
merged 3 commits into from
May 18, 2025

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented May 4, 2025

@Nadahar see f5f8921#r156317816

The compiler issued warnings about null type mismatch. There may be a small possibility that it would return null in case modelCache/model is modified elsewhere perhaps. This refactor removes that possibility and as a result the compiler no longer has a warning about it.

@jimtng jimtng requested a review from a team as a code owner May 4, 2025 00:36
return false;
}

List<JsonNode> removedNodes = e.getValue();
Copy link
Contributor

@lolodomo lolodomo May 6, 2025

Choose a reason for hiding this comment

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

Please check that removedNodes is not null before calling parseJsonNodesV1. parseJsonNodesV1 expects a non nullable list as parameter.
It generates an error in Eclipse if not for a good reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a null check here

@jimtng jimtng requested a review from lolodomo May 6, 2025 10:10
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM

jimtng added 3 commits May 11, 2025 21:27
@jimtng jimtng force-pushed the yaml-null-warnings branch from 68fb6ad to a459a79 Compare May 11, 2025 11:29
@jimtng
Copy link
Contributor Author

jimtng commented May 11, 2025

rebased

Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks!

@kaikreuzer kaikreuzer merged commit 825def2 into openhab:main May 18, 2025
4 checks passed
@kaikreuzer kaikreuzer added this to the 5.0 milestone May 18, 2025
@kaikreuzer kaikreuzer added the bug An unexpected problem or unintended behavior of the Core label May 18, 2025
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.

3 participants