Skip to content

Fix: correct JSON parsing in AdminEReportingHeaderController to handle ArrayNode properly#1596

Open
Manas-Dikshit wants to merge 1 commit into52North:developfrom
Manas-Dikshit:develop
Open

Fix: correct JSON parsing in AdminEReportingHeaderController to handle ArrayNode properly#1596
Manas-Dikshit wants to merge 1 commit into52North:developfrom
Manas-Dikshit:develop

Conversation

@Manas-Dikshit
Copy link

@Manas-Dikshit Manas-Dikshit commented Feb 19, 2026

Fix: Correct JSON parsing in AdminEReportingHeaderController

The save() method incorrectly treated reportObligations as an object using fieldNames(),
while getJSON() encodes it as an array. This caused obligations to not be saved properly.

Before:

Iterator<String> it = obligations.fieldNames(); //  ArrayNode has no field names

After:

for (JsonNode obligationNode : obligationsNode) { //  iterate array safely
    String id = obligationNode.path(AQDJSONConstants.ID).asText();
    
}

Properly iterates over ArrayNode
Adds null/invalid ID checks and logging
Fixes data not being persisted during POST

Result: Controller now correctly saves all reporting obligations with stable JSON decoding.

Updated JSON handling in save method to correctly process report obligations as an array.
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.

1 participant