Skip to content

FINERACT-2694: Return validation errors instead of 500 NPE when type parameters are omitted#6149

Open
Abhishek6122008 wants to merge 3 commits into
apache:developfrom
Abhishek6122008:bugfix/FINERACT-2694-validator-npe-missing-type-params
Open

FINERACT-2694: Return validation errors instead of 500 NPE when type parameters are omitted#6149
Abhishek6122008 wants to merge 3 commits into
apache:developfrom
Abhishek6122008:bugfix/FINERACT-2694-validator-npe-missing-type-params

Conversation

@Abhishek6122008

@Abhishek6122008 Abhishek6122008 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Description

Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.

Your assigned reviewer(s) will follow our guidelines for code reviews.

…parameters are omitted

SmsCampaignValidator, EmailCampaignValidator and StandingInstructionDataValidator
queue a notNull validation error for triggerType/campaignType/transferType but
dereference the extracted value (intValue() / enum fromInt switch) before the
queued errors are thrown. Omitting the parameter therefore crashes with a
NullPointerException and the API returns HTTP 500 instead of the intended 400
with the "parameter is mandatory" error.

Add null guards at each dereference so the already-queued validation errors
surface, and add regression tests reproducing the NPE for all three validators.
@Abhishek6122008 Abhishek6122008 changed the title FINERACT-2694: Return validation errors instead of 500 NPE when type parameters are omitted parameters are omitted FINERACT-2694: Return validation errors instead of 500 NPE when type parameters are omitted Jul 19, 2026
… validator tests

The recurrence-detail regression tests built their request JSON with
String.formatted() on a text block containing newlines, which SpotBugs flags as
VA_FORMAT_STRING_USES_NEWLINE and failed the spotbugsTest quality check. Build
the JSON with String.replace() instead so no format string is involved; the
enum value is still resolved at compile time and the assertions are unchanged.
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