You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Foo Developer (Jira)" <ji...@apache.org> on 2026/09/28 12:25:00 UTC
[jira] [Created] (FINERACT-2860) Creating or updating a report fails with 501 when a report parameter has a JSON null member
Foo Developer created FINERACT-2860:
---------------------------------------
Summary: Creating or updating a report fails with 501 when a report parameter has a JSON null member
Key: FINERACT-2860
URL: https://issues.apache.org/jira/browse/FINERACT-2860
Project: Apache Fineract
Issue Type: Bug
Components: Reports
Reporter: Foo Developer
Assignee: Foo Developer
h3. Steps to reproduce
On stock Fineract (develop), call {{POST /fineract-provider/api/v1/reports}} with a report parameter whose {{reportParameterName}} is an explicit JSON null, for example:
{code:json}{
"reportName": "Null param test",
"reportType": "Table",
"reportCategory": "Client",
"reportSql": "select 1",
"reportParameters": [ { "id": "", "parameterId": 1, "reportParameterName": null } ]
}
{code}
h3. Expected
The report is created. A null {{reportParameterName}} (or a null {{id}} / {{parameterId}}) is treated the same as an absent member.
h3. Actual
The request fails with HTTP 501 Not Implemented, caused by {{java.lang.UnsupportedOperationException: JsonNull}}.
h3. Root cause
{{ReportWritePlatformServiceImpl.assembleSetOfReportParameterUsages}} guards the {{id}}, {{parameterId}} and {{reportParameterName}} members with {{JsonObject.has(name)}} only, then calls {{getAsString()}} / {{getAsLong()}}. Gson's {{has()}} returns true for a member that is present with a JSON null value, and {{getAsString()}} / {{getAsLong()}} on {{JsonNull}} throw {{UnsupportedOperationException}}, which the generic exception mapper turns into a 501. Clients that serialize unset fields as null instead of omitting them hit this on every create. The update branch has the same latent defect for {{reportParameterName}}.
h3. Proposed fix
Add {{&& !jsonObject.get(name).isJsonNull()}} next to each {{has(name)}} check in the method (id, both parameterId reads, both reportParameterName reads), so a JSON null is handled like a missing member. Unit test: a parameter with a null {{reportParameterName}} assembles without throwing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)