Skip to content

backport: fix: resolve OUG{} indicator count to zero when org unit has no group members [2.41]#24271

Open
jason-p-pickering wants to merge 1 commit into
2.41from
fix/oug-indicator-npe_2.41
Open

backport: fix: resolve OUG{} indicator count to zero when org unit has no group members [2.41]#24271
jason-p-pickering wants to merge 1 commit into
2.41from
fix/oug-indicator-npe_2.41

Conversation

@jason-p-pickering

Copy link
Copy Markdown
Contributor

Backport of 24aa365

… members (#24266)

ItemOrgUnitGroupCount.evaluate read visitor.getParams().getOrgUnitCountMap()
unguarded. In the analytics indicator path (DataHandler.getIndicatorValue), the
per-org-unit target count map is null when the org unit target aggregation
returns no row for an org unit — i.e. when that org unit's subtree contains no
members of the referenced group. This produced a NullPointerException (HTTP 500)
on analytics requests for any indicator using OUG{} over such an org unit, e.g.

  GET /api/analytics.json?dimension=dx:<oug-indicator>&dimension=ou:LEVEL-3&dimension=pe:2025

A missing entry means a count of zero, not an error. Treat both a null map and a
missing group entry as zero, consistent with how analytics treats absent counts.
This also removes the prior "Cannot find count" throw, which likewise bubbled up
as a 500 since getIndicatorValueObject does not catch it.

Pre-existing latent bug (the unguarded line dates to 2023); rare because it
requires an OUG{} indicator and an org unit whose subtree has zero matching
members.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@jason-p-pickering jason-p-pickering changed the title fix: resolve OUG{} indicator count to zero when org unit has no group… backport: fix: resolve OUG{} indicator count to zero when org unit has no group Jun 23, 2026
@jason-p-pickering jason-p-pickering changed the title backport: fix: resolve OUG{} indicator count to zero when org unit has no group backport: fix: resolve OUG{} indicator count to zero when org unit has no group members Jun 23, 2026
@jason-p-pickering jason-p-pickering requested a review from a team June 23, 2026 14:00
@jason-p-pickering jason-p-pickering changed the title backport: fix: resolve OUG{} indicator count to zero when org unit has no group members backport: fix: resolve OUG{} indicator count to zero when org unit has no group members [2.41] Jun 24, 2026
@jason-p-pickering jason-p-pickering requested review from a team and david-mackessy June 25, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants