Skip to content

FINERACT-2181: Improve validation error messages for interest rate chart slabs in FD and RD products - #4793

Closed
abhinav-1305 wants to merge 3 commits into
apache:developfrom
abhinav-1305:feature/better-slab-validation-messages
Closed

abhinav-1305 wants to merge 3 commits into
apache:developfrom
abhinav-1305:feature/better-slab-validation-messages

Conversation

@abhinav-1305

@abhinav-1305 abhinav-1305 commented Jun 20, 2025 •

Copy link
Copy Markdown

Description

Describe the changes made and why they were made.

Implements a fix for FINERACT-2316

Checklist

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

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Please run ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest to fix checkstyle issues!

@bharathcgowda

Copy link
Copy Markdown

@abhinav-1305 did we address the comments raised by @adamsaghy ?

I see 3 checks are still failing, not sure if it is something you need to look into or ignore for this PR

@abhinav-1305

Copy link
Copy Markdown
Author

Hi @bharathcgowda, I haven't looked at it yet. I'll be pushing a fix for the CI failure tonight.

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 What's up here?

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 What's up on this?

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 What's up here?

@abhinav-1305

Copy link
Copy Markdown
Author

Hi @bharathcgowda - 1 test is failing can you look at it?

@bharathcgowda

Copy link
Copy Markdown

Hi @adamsaghy, one test case is failing. Could you please help @abhinav-1305 with it?

@adamsaghy

Copy link
Copy Markdown
Contributor
* What went wrong:
Execution failed for task ':fineract-savings:spotlessJavaCheck'.
> The following files had format violations:
      src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
          @@ -144,14 +144,16 @@
           ························&&·nextSlabs.slabFields().isValidChart(isPrimaryGroupingByAmount))·{
           ····················if·(iSlabs.slabFields().isRateChartOverlapping(nextSlabs.slabFields(),·isPrimaryGroupingByAmount))·{
           ························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.range.overlapping",
          -································slabContext·+·"·and·"·+·nextSlabContext·+·"There·is·an·overlap·between·these·slabs.·Please·ensure·slabs·do·not·overlap.",
          +································slabContext·+·"·and·"·+·nextSlabContext
          +········································+·"There·is·an·overlap·between·these·slabs.·Please·ensure·slabs·do·not·overlap.",
           ································iSlabs.slabFields().fromPeriod(),·iSlabs.slabFields().toPeriod(),·nextSlabs.slabFields().fromPeriod(),
           ································nextSlabs.slabFields().toPeriod(),·iSlabs.slabFields().getAmountRangeFrom(),
           ································iSlabs.slabFields().getAmountRangeTo(),·nextSlabs.slabFields().getAmountRangeFrom(),
           ································nextSlabs.slabFields().getAmountRangeTo());
           ····················}·else·if·(iSlabs.slabFields().isRateChartHasGap(nextSlabs.slabFields(),·isPrimaryGroupingByAmount))·{
           ························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.range.has.gap",
          -································slabContext·+·"·and·"·+·nextSlabContext·+·"There·is·a·gap·between·these·slabs.·Please·ensure·slabs·are·continuous.",
          +································slabContext·+·"·and·"·+·nextSlabContext
          +········································+·"There·is·a·gap·between·these·slabs.·Please·ensure·slabs·are·continuous.",
           ································iSlabs.slabFields().fromPeriod(),·iSlabs.slabFields().toPeriod(),·nextSlabs.slabFields().fromPeriod(),
           ································nextSlabs.slabFields().toPeriod(),·iSlabs.slabFields().getAmountRangeFrom(),
           ································iSlabs.slabFields().getAmountRangeTo(),·nextSlabs.slabFields().getAmountRangeFrom(),
          @@ -172,7 +174,8 @@
           ····················}·else·if·(!iSlabs.slabFields().isPeriodsSame(nextSlabs.slabFields()))·{
           ························if·(InterestRateChartSlabFields.isNotProperAmountStart(nextSlabs.slabFields()))·{
           ····························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.amount.range.start.incorrect",
          -····································nextSlabContext·+·"The·start·amount·of·this·slab·is·incorrect.",·nextSlabs.slabFields().getAmountRangeFrom());
          +····································nextSlabContext·+·"The·start·amount·of·this·slab·is·incorrect.",
          +····································nextSlabs.slabFields().getAmountRangeFrom());
           ························}
           ························if·(iSlabs.slabFields().getAmountRangeTo()·!=·null)·{
           ····························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.amount.range.end.incorrect",
  Run './gradlew :fineract-savings:spotlessApply' to fix these violations.

Run this:
./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@bharathcgowda

Copy link
Copy Markdown

@abhinav-1305 can you check @adamsaghy comment please?

@IOhacker IOhacker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that the proposed changes for improving the validation will cause difficult to be translated to another language.

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Would you mind rewrite to use Hibernate Validation messages that got resolved?
You can use: final String interpolatedMessage = messageSource.getMessage(messageKey, null, LocaleContextHolder.getLocale()); to interpolate the message based on the localization.

@sidshas03

Copy link
Copy Markdown
Contributor

Hi repo authors (@abhinav-1305, @adamsaghy, @bharathcgowda) 👋
I’ve been following PR #4793 for FINERACT-2316 and noticed it’s been open for a while with review feedback. I went through the code and I can take this forward by implementing the parts that are still pending.

https://issues.apache.org/jira/browse/FINERACT-2316

@bharathcgowda

Copy link
Copy Markdown

Hi @sidshas03 Thank you for volunteering. Feel free to make the necessary changes

sidshas03 added a commit to sidshas03/fineract that referenced this pull request Sep 16, 2025
…args); add tests; fix CI

- Replace hard-coded error messages with message codes in InterestRateChart.java
- Use failWithCode method instead of failWithCodeNoParameterAddedToErrorCode
- Add message keys to fineract-provider/src/main/resources/messages.properties
- Add German translations in messages_de.properties
- Create unit tests for overlap and gap validation error codes and arguments
- Update tests to assert both error codes and arguments properly
- All quality checks pass (spotless, checkstyle, spotbugs, tests)

This supersedes PR apache#4793 and provides proper internationalization support
for interest rate chart validation error messages without domain layer coupling.
@adamsaghy

Copy link
Copy Markdown
Contributor
* What went wrong:
Execution failed for task ':fineract-savings:spotlessJavaCheck'.
> The following files had format violations:
      src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java
          @@ -144,14 +144,16 @@
           ························&&·nextSlabs.slabFields().isValidChart(isPrimaryGroupingByAmount))·{
           ····················if·(iSlabs.slabFields().isRateChartOverlapping(nextSlabs.slabFields(),·isPrimaryGroupingByAmount))·{
           ························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.range.overlapping",
          -································slabContext·+·"·and·"·+·nextSlabContext·+·"There·is·an·overlap·between·these·slabs.·Please·ensure·slabs·do·not·overlap.",
          +································slabContext·+·"·and·"·+·nextSlabContext
          +········································+·"There·is·an·overlap·between·these·slabs.·Please·ensure·slabs·do·not·overlap.",
           ································iSlabs.slabFields().fromPeriod(),·iSlabs.slabFields().toPeriod(),·nextSlabs.slabFields().fromPeriod(),
           ································nextSlabs.slabFields().toPeriod(),·iSlabs.slabFields().getAmountRangeFrom(),
           ································iSlabs.slabFields().getAmountRangeTo(),·nextSlabs.slabFields().getAmountRangeFrom(),
           ································nextSlabs.slabFields().getAmountRangeTo());
           ····················}·else·if·(iSlabs.slabFields().isRateChartHasGap(nextSlabs.slabFields(),·isPrimaryGroupingByAmount))·{
           ························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.range.has.gap",
          -································slabContext·+·"·and·"·+·nextSlabContext·+·"There·is·a·gap·between·these·slabs.·Please·ensure·slabs·are·continuous.",
          +································slabContext·+·"·and·"·+·nextSlabContext
          +········································+·"There·is·a·gap·between·these·slabs.·Please·ensure·slabs·are·continuous.",
           ································iSlabs.slabFields().fromPeriod(),·iSlabs.slabFields().toPeriod(),·nextSlabs.slabFields().fromPeriod(),
           ································nextSlabs.slabFields().toPeriod(),·iSlabs.slabFields().getAmountRangeFrom(),
           ································iSlabs.slabFields().getAmountRangeTo(),·nextSlabs.slabFields().getAmountRangeFrom(),
          @@ -172,7 +174,8 @@
           ····················}·else·if·(!iSlabs.slabFields().isPeriodsSame(nextSlabs.slabFields()))·{
           ························if·(InterestRateChartSlabFields.isNotProperAmountStart(nextSlabs.slabFields()))·{
           ····························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.amount.range.start.incorrect",
          -····································nextSlabContext·+·"The·start·amount·of·this·slab·is·incorrect.",·nextSlabs.slabFields().getAmountRangeFrom());
          +····································nextSlabContext·+·"The·start·amount·of·this·slab·is·incorrect.",
          +····································nextSlabs.slabFields().getAmountRangeFrom());
           ························}
           ························if·(iSlabs.slabFields().getAmountRangeTo()·!=·null)·{
           ····························baseDataValidator.failWithCodeNoParameterAddedToErrorCode("chart.slabs.amount.range.end.incorrect",
  Run './gradlew :fineract-savings:spotlessApply' to fix these violations.

@bharathcgowda

Copy link
Copy Markdown

@sidshas03 @adamsaghy anything pending to be done on this?

sidshas03 added a commit to sidshas03/fineract that referenced this pull request Oct 2, 2025
- Fix formatting violations in InterestRateChart.java
- Addresses Spotless check failures mentioned by @adamsaghy
- Resolves CI build issues preventing PR merge

Fixes apache#4793
@IOhacker

Copy link
Copy Markdown
Contributor

@abhinav-1305 squash and commit and check the error

sidshas03 added a commit to sidshas03/fineract that referenced this pull request Nov 3, 2025
…args); add tests; fix CI

- Replace hard-coded error messages with message codes in InterestRateChart.java
- Use failWithCode method instead of failWithCodeNoParameterAddedToErrorCode
- Add message keys to fineract-provider/src/main/resources/messages.properties
- Add German translations in messages_de.properties
- Create unit tests for overlap and gap validation error codes and arguments
- Update tests to assert both error codes and arguments properly
- All quality checks pass (spotless, checkstyle, spotbugs, tests)

This supersedes PR apache#4793 and provides proper internationalization support
for interest rate chart validation error messages without domain layer coupling.
@github-actions

Copy link
Copy Markdown

This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.

@github-actions github-actions Bot added the stale label Nov 14, 2025
@adamsaghy adamsaghy closed this Nov 25, 2025
@adamsaghy adamsaghy reopened this Nov 25, 2025
@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Please check the failing test case.

@github-actions github-actions Bot removed the stale label Nov 26, 2025
@adamsaghy
adamsaghy marked this pull request as draft December 2, 2025 09:06
@github-actions

github-actions Bot commented Jan 2, 2026

Copy link
Copy Markdown

This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.

@github-actions github-actions Bot added the stale label Jan 2, 2026
@bharathcgowda

Copy link
Copy Markdown

@abhinav-1305 would you be able to look into the comments and fix?
cc @adamsaghy @IOhacker

@github-actions github-actions Bot removed the stale label Jan 30, 2026
@github-actions

github-actions Bot commented Mar 1, 2026

Copy link
Copy Markdown

This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.

@github-actions github-actions Bot added the stale label Mar 1, 2026
@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Please rebase.

@github-actions github-actions Bot removed the stale label Mar 10, 2026
@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Please rebase.

@adamsaghy

Copy link
Copy Markdown
Contributor

@abhinav-1305 Closing due to abandonment. Please reopen if you are still want to work on it!

@adamsaghy adamsaghy closed this Apr 8, 2026
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.

5 participants