Skip to content

Conversation

@abhinav-1305
Copy link

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

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!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests
  • 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 coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/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
  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

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

@adamsaghy
Copy link
Contributor

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

@bharathcgowda
Copy link

@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
Author

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

@adamsaghy
Copy link
Contributor

@abhinav-1305 What's up here?

@adamsaghy
Copy link
Contributor

@abhinav-1305 What's up on this?

@adamsaghy
Copy link
Contributor

@abhinav-1305 What's up here?

@abhinav-1305
Copy link
Author

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

@bharathcgowda
Copy link

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

@adamsaghy
Copy link
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

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

Copy link
Contributor

@IOhacker IOhacker left a comment

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
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

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

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
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

@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
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

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
Contributor

@abhinav-1305 Please check the failing test case.

@github-actions github-actions bot removed the stale label Nov 26, 2025
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