Skip to content

fix: avoid ERROR log when safeInvoke falls back to interface method [DHIS2-22114] (2.43) - #25285

Merged
netroms merged 1 commit into
2.43from
DHIS2-22114_2.43
Sep 20, 2026
Merged

netroms merged 1 commit into
2.43from
DHIS2-22114_2.43

Conversation

@netroms

@netroms netroms commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Backport of #25220 to 2.43.

Jira: https://dhis2.atlassian.net/browse/DHIS2-22114

Stops GET /api/dimensions/{uid}/items from logging an ERROR stack trace when safeInvoke falls back to the interface method (DHIS2-20730). Cherry-pick of 7153c01 includes the null-Method guard from that squash. Clean apply, no conflicts.

Verification: DefaultSchemaServiceSafeInvokeTest 7/7 pass on Java 17; testInterfaceFallbackDoesNotInvokeBaseMethod fails pre-fix with NeverWantedButInvoked. Targeted Spotless passed.

AI Assisted

…DHIS2-22114] (#25220)

* fix: avoid ERROR log when safeInvoke falls back to interface method [DHIS2-22114]

* fix: Guard null method in safeInvoke precheck [DHIS2-22114]

ReflectionUtils.invokeMethod returns null for a null Method, so
safeInvoke(object, null) returned null before the instanceof precheck
was added. The precheck dereferenced method first and threw an
unwrapped NullPointerException. Property.getGetterMethod() is null for
a @JsonProperty field without a getter, and several callers pass it
straight through.

Check method for null before the precheck and pin the contract with a
test.

---------

Co-authored-by: Morten Svanaes <msvanaes@dhis2.org>
(cherry picked from commit 7153c01)
@sonarqubecloud

Copy link
Copy Markdown

@netroms
netroms enabled auto-merge (squash) September 19, 2026 14:54
@netroms
netroms merged commit 98a3420 into 2.43 Sep 20, 2026
18 checks passed
@netroms
netroms deleted the DHIS2-22114_2.43 branch September 20, 2026 02:59
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.

3 participants