Fix agent prosecutor authority access JSON parsing (CIMD-3294 regression) - #63
Merged
allanmckenzie merged 1 commit intoJul 14, 2026
Conversation
…ion) ProsecutingAuthorityProvider.buildFromResponseJson parsed the agentProsecutorAuthorityAccess response field as an array of JsonObject elements, each with a "prosecutingAuthority" property. The field is actually an array of strings, so at runtime this threw "ClassCastException: org.eclipse.parsson.JsonStringImpl cannot be cast to jakarta.json.JsonObject" whenever a user had agent prosecutor access (e.g. mi-reportdata sjp resulted-cases-count and case-export endpoints). Restore the original, correct parsing from release/17.104.x-DD-41592 (getValuesAs(JsonString.class) + JsonString::getString). The commit that recreated this CIMD-3294 feature on the 25.104.x line (5f6e092) reimplemented the parsing with the wrong element type and added no test for the agent-access path, so the regression shipped unnoticed. Add ProsecutingAuthorityProviderTest coverage for parsing the string array and for granting access via an agent prosecutor authority. Bump hearing.version 17.104.168 -> 17.104.176 in the root pom to satisfy enforce-moj-latest-interfaces (latest released hearing-query-api RAML).
allanmckenzie
requested review from
oktayekincioglu,
santhosh-hmcts and
zozd-hmcts
and removed request for
a team
July 14, 2026 09:28
oktayekincioglu
approved these changes
Jul 14, 2026
zozd-hmcts
approved these changes
Jul 14, 2026
allanmckenzie
deleted the
dev/fix-agent-prosecutor-authority-json-parsing
branch
July 14, 2026 10:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ProsecutingAuthorityProvider.buildFromResponseJson(access-control-sjp-providers) parsed theagentProsecutorAuthorityAccessresponse field as an array of JsonObjects, each expected to hold aprosecutingAuthoritystring property:But
agentProsecutorAuthorityAccessis an array of strings. At runtime this throws:for any user with agent prosecutor access. It surfaced as HTTP 500s on
cpp-context-mi-reportdata's SJPresulted-cases-countandcase-exportendpoints during the Java 25 / WildFly 40 upgrade (CasesCountIT.shouldVerifyResultedCasesCountMultipleAgents,CaseExportInJsonFormatExtractIT).Where this code came from / root cause
The original, correct CIMD-3294 implementation on
release/17.104.x-DD-41592parsed the field as strings:When the feature was recreated on the 25.104.x line in commit
5f6e0925("Restore agent prosecutor authority access (CIMD-3294)"), the parsing was reimplemented with the wrong element type (JsonObjectinstead ofJsonString) and no test was added for the agent-access path, so the regression shipped in25.104.0-M7unnoticed.Fix
getValuesAs(JsonString.class)+JsonString::getString) fromrelease/17.104.x-DD-41592.ProsecutingAuthorityProviderTestcoverage: parse the string array into the access list, and grant access via an agent prosecutor authority. (Reproduces the CCE with the old code; green with the fix.)hearing.version17.104.168→17.104.176in the root pom to satisfyenforce-moj-latest-interfaces(latest releasedhearing-query-apiRAML).Verification
cpp-platform-librariesreactor build green (enforcer on);ProsecutingAuthorityProviderTest11/11, jacoco coverage met.mi-reportdata: patched only this class into the deployed WAR and re-ran the affected ITs —CaseExportInJsonFormatExtractIT2/2 andCasesCountIT5/5 (incl.…MultipleAgents) now pass.🤖 Generated with Claude Code