KAF-487:Added checks to handle null filings#17
Conversation
There was a problem hiding this comment.
Pull request overview
Adds defensive null-handling across the filing resource handling pipeline so that null filings, resources, transaction IDs, submission IDs, filing types/links, and individual FilingApi array entries no longer cause NullPointerExceptions. Expands unit test coverage in SubmissionIdServiceTest / FilingResourceProcessorServiceTest and adds a Kafka integration test for the filings == null path.
Changes:
SubmissionIdServicenow guards against null/emptyfilings, null submission IDs, null transaction IDs, null filing types/links, and additionally catchesStringIndexOutOfBoundsExceptionwhen parsing offsets.FilingResourceProcessorServiceskips null entries within theFilingApi[]returned by the Filing API and logs an info message.ResourceMapFactoryreturns an empty map when transaction resources are null, and guards iteration against null resources.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/.../service/SubmissionIdService.java |
Null-safe handling of transaction id, filings map, submission ids, filing type/links; broader exception catch. |
src/main/java/.../service/FilingResourceProcessorService.java |
Skips and logs null entries in the FilingApi[] response. |
src/main/java/.../factory/ResourceMapFactory.java |
Returns empty map when resources are null; guards iteration in populateResourceMap. |
src/test/java/.../service/SubmissionIdServiceTest.java |
New tests for null/empty filings, null submission/transaction ids, SIOOBE path, null type/links/resource. |
src/test/java/.../service/FilingResourceProcessorServiceTest.java |
New test for null entry inside FilingApi[]. |
src/test/java/.../kafka/ConsumerIT.java |
Integration test verifying successful processing when transaction.filings is null. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eaf8566 to
4751c76
Compare
f83a09d to
457d9ee
Compare
*This pr will add go like behavior where instead of null pointer go automatically overrides object to be empty the same will happen in Java resolves:[KAF-487](https://companieshouse.atlassian.net/browse/KAF-487)
457d9ee to
3106314
Compare
|




*This pr will add go like behavior where instead of null pointer go automatically overrides object to be empty the same will happen in Java resolves:KAF-487
Describe the changes
Related Jira tickets
Jira Ticket
Developer check list
General
READMEup to date?POMbeen updated for the latest versions of dependencies?main?Testing
Release preparation
Where possible, add links to the respective Jira tickets when an item is checked
docker-chs-developmentdeployment or test data?chs-configs?Notes to the tester
Add any testing hints or instructions here.