Skip to content

fix(rest): avoid NPE in obligation Boolean filter#3882

Open
YianZhao wants to merge 1 commit intoeclipse-sw360:mainfrom
YianZhao:fix/restcontrollerhelper-boolean-null-check
Open

fix(rest): avoid NPE in obligation Boolean filter#3882
YianZhao wants to merge 1 commit intoeclipse-sw360:mainfrom
YianZhao:fix/restcontrollerhelper-boolean-null-check

Conversation

@YianZhao
Copy link
Contributor

@YianZhao YianZhao commented Mar 13, 2026

Closes: #3881

Summary

This PR fixes a possible NullPointerException in RestControllerHelper#getObligationIdsFromRequestWithValueTrue(...).

The previous implementation used:
reqBodyMap.getValue().equals(true)
which could throw an NPE if the map contained a null value.

Changes made

  • Replaced the Boolean check with Boolean.TRUE.equals(...)
  • Simplified the stream pipeline to directly collect matching keys into a Set

Before
.filter(reqBodyMap -> reqBodyMap.getValue().equals(true))

After
.filter(entry -> Boolean.TRUE.equals(entry.getValue()))

Result

  • Prevents NPE for null Boolean values
  • Keeps the intended behavior of returning only keys with value true

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boolean null values in obligation filter can trigger NPE

2 participants