You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "Harshitmehra-270709 (via GitHub)" <gi...@apache.org> on 2026/03/08 07:56:46 UTC

[PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Harshitmehra-270709 opened a new pull request, #5596:
URL: https://github.com/apache/fineract/pull/5596

   ## Description
   
   Fixes [FINERACT-2511](https://issues.apache.org/jira/browse/FINERACT-2511): Invalid `dateFormat` on client create returns HTTP 500 instead of 400 Bad Request.
   
   ### Root Cause
   
   When an invalid `dateFormat` value (e.g., `02 February 2026` instead of a valid pattern like `dd MMMM yyyy`) is provided in `POST /fineract-provider/api/v1/clients`, `ClientDataValidator.validateForCreate()` does not validate this parameter. The invalid value reaches `DateTimeFormatter.ofPattern(command.dateFormat())` in `ClientWritePlatformServiceJpaRepositoryImpl.createClient()`, which throws `IllegalArgumentException`. This uncaught exception surfaces as HTTP 500.
   
   ### Changes
   
   1. **`DataValidatorBuilder.java`** - Added a reusable `validDateTimeFormatPattern()` method that validates date/time format pattern strings by attempting `DateTimeFormatter.ofPattern()` and catching `IllegalArgumentException`. This method follows the existing fluent API pattern and can be reused by other validators across the codebase.
   
   2. **`ClientDataValidator.java`** - Added `dateFormat` validation in both `validateForCreate()` and `validateForUpdate()` using the new `validDateTimeFormatPattern()` method. Invalid patterns are now caught during validation and returned as HTTP 400 with a clear error message.
   
   3. **`DataValidatorBuilderDateFormatTest.java`** [NEW] - 12 parameterized unit tests covering:
      - Valid patterns (`dd MMMM yyyy`, `yyyy-MM-dd`, `dd/MM/yyyy`, `MM/dd/yyyy`, `dd-MM-yyyy HH:mm:ss`)
      - Invalid patterns (`02 February 2026`, `not-a-pattern`, `P!@#$`, `{{invalid}}`)
      - Null value handling (with and without `ignoreIfNull`)
      - Blank value handling
   
   ### Testing
   
   - All 12 unit tests pass (0 failures, 0 errors)
   - `fineract-core:compileJava` BUILD SUCCESSFUL
   - Code formatted via `spotlessJavaApply`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5596:
URL: https://github.com/apache/fineract/pull/5596


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Posted by "Harshitmehra-270709 (via GitHub)" <gi...@apache.org>.
Harshitmehra-270709 closed pull request #5596: FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500
URL: https://github.com/apache/fineract/pull/5596


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Posted by "Harshitmehra-270709 (via GitHub)" <gi...@apache.org>.
Harshitmehra-270709 commented on PR #5596:
URL: https://github.com/apache/fineract/pull/5596#issuecomment-4034034956

   > @Harshitmehra-270709 Please rebase this PR with latest `develop` branch. Please make sure you have a configured GPG signature and valid email address.
   
   Yes, sir, I did all the changes, and I have a question: Where do all the contributors and maintainers hang out?
   or discuss things?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5596:
URL: https://github.com/apache/fineract/pull/5596#issuecomment-4054217131

   > > @Harshitmehra-270709 Please rebase this PR with latest `develop` branch. Please make sure you have a configured GPG signature and valid email address.
   > 
   > Yes, sir, I did all the changes, and I have a question: Where do all the contributors and maintainers hang out? or discuss things?
   
   Official dev mail list:
   https://fineract.apache.org -> Mailing list
   
   Unofficial slack channel:
   "Mifos" as the organization and look for "fineract" channel.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2511: Validate dateFormat parameter to return HTTP 400 instead of 500 [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5596:
URL: https://github.com/apache/fineract/pull/5596#issuecomment-4022419074

   @Harshitmehra-270709 Please rebase this PR with latest `develop` branch.
   Please make sure you have a configured GPG signature and valid email address.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org