FINERACT-2708: Fix duplicate defined name 500 in bulk-import transaction templates - #6180
Open
oluexpert99 wants to merge 1 commit into
Open
FINERACT-2708: Fix duplicate defined name 500 in bulk-import transaction templates#6180oluexpert99 wants to merge 1 commit into
oluexpert99 wants to merge 1 commit into
Conversation
…ion templates - Downloading the savings, recurring-deposit or fixed-deposit transaction template failed with HTTP 500 (IllegalArgumentException: The workbook already contains this name: Account_<client>_<id>_) on tenants where one client holds more than one account. The template is unusable for the whole tenant; there is no API workaround. - setNames builds one Account_<client>_<id>_ defined name per client, collecting clients by walking the account lookup table and starting a new run whenever the client name changes. That run detection uses a case-sensitive String.equals, but the table it walks was just sorted with SavingsAccountData.ClientNameComparator, which compares the names case-INSENSITIVELY (both upper-cased). Two clients whose names differ only in case therefore compare equal to the sort and may be interleaved, which splits one client's accounts into two runs; the second run re-adds the same client and the per-client loop then asks POI to create a defined name that already exists. - Guard the collection so a client name that has already been recorded is not added again, mirroring the guard LoanRepaymentWorkbookPopulator.setNames already has. Each client contributes exactly one defined name, whatever its account count; nothing changes for tenants that never hit the collision. - Apply the same guard to all three affected populators (SavingsTransactionsWorkbookPopulator, RecurringDepositTransactionWorkbookPopulator, FixedDepositTransactionWorkbookPopulator), which carry identical copies of the loop. - Add a unit test per populator: three accounts (client 18, client 19 whose name differs from 18's only in case, then client 18 again) reproduce the split-run ordering. Each test fails on the unfixed code with the exact production exception and asserts one defined name per client, still distinct when upper-cased since Excel defined names are case-insensitive. Signed-off-by: oluexpert99 <farooq@techservicehub.io>
Contributor
|
@oluexpert99 please check the failing log. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!
Your assigned reviewer(s) will follow our guidelines for code reviews.