Skip to content

KAF-487:Added checks to handle null filings#17

Open
vaibhavcompanieshouse wants to merge 1 commit into
mainfrom
feature/kaf-487-using-restclient
Open

KAF-487:Added checks to handle null filings#17
vaibhavcompanieshouse wants to merge 1 commit into
mainfrom
feature/kaf-487-using-restclient

Conversation

@vaibhavcompanieshouse
Copy link
Copy Markdown
Contributor

@vaibhavcompanieshouse vaibhavcompanieshouse commented May 29, 2026

*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

  • Is the PR as small as it can be?
  • Has the Jira ticket been updated with any relevant comments?
  • Is the README up to date?
  • Has the POM been updated for the latest versions of dependencies?
  • Has the code been double-checked against main?
  • Does the code adhere standards in this repository, including SonarQube checks?

Testing

  • Do the code changes have unit and integration tests with code coverage > 80%?
  • Has the code been tested locally and/or passed the API Karate tests on docker-chs-development?
  • Have mandatory manual test cases been run?
  • Are extra Karate tests required?
  • Are all the test data resources up to date?

Release preparation

Where possible, add links to the respective Jira tickets when an item is checked

  • Have these changes been included in a release ticket?
  • Are changes required to the docker-chs-development deployment or test data?
  • Are any changes required to the environment added to chs-configs?

Notes to the tester

Add any testing hints or instructions here.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • SubmissionIdService now guards against null/empty filings, null submission IDs, null transaction IDs, null filing types/links, and additionally catches StringIndexOutOfBoundsException when parsing offsets.
  • FilingResourceProcessorService skips null entries within the FilingApi[] returned by the Filing API and logs an info message.
  • ResourceMapFactory returns 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.

@vaibhavcompanieshouse vaibhavcompanieshouse force-pushed the feature/kaf-487-using-restclient branch 2 times, most recently from eaf8566 to 4751c76 Compare May 29, 2026 15:48
@vaibhavcompanieshouse vaibhavcompanieshouse force-pushed the feature/kaf-487-using-restclient branch 3 times, most recently from f83a09d to 457d9ee Compare June 1, 2026 03:50
*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)
@vaibhavcompanieshouse vaibhavcompanieshouse force-pushed the feature/kaf-487-using-restclient branch from 457d9ee to 3106314 Compare June 1, 2026 14:35
@chsonarqubeprchecks
Copy link
Copy Markdown

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.

2 participants