Copilot commented on code in PR #5881:
URL: https://github.com/apache/fineract/pull/5881#discussion_r3292148884


##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorHelper.java:
##########
@@ -261,13 +261,14 @@ public SavingsDTO populateSavingsDtoFromMap(final 
Map<String, Object> accounting
                 }
             }
 
-            if (!isAccountTransfer) {
-                isAccountTransfer = 
this.accountTransfersReadPlatformService.isAccountTransfer(Long.parseLong(transactionId),
+            boolean localIsAccountTransfer = isAccountTransfer;
+            if (!localIsAccountTransfer) {
+                localIsAccountTransfer = 
this.accountTransfersReadPlatformService.isAccountTransfer(Long.parseLong(transactionId),
                         PortfolioAccountType.SAVINGS);
             }

Review Comment:
   This change stops updating `isAccountTransfer` with the computed value and 
instead only updates `localIsAccountTransfer`. If this code is inside a loop 
and `isAccountTransfer` was previously used as a cache/short-circuit (set to 
true after the first positive lookup), the new logic will re-call 
`accountTransfersReadPlatformService.isAccountTransfer(...)` for each iteration 
when `isAccountTransfer` starts as false. If the intent was to avoid mutating 
the original variable, consider either (a) renaming `isAccountTransfer` to 
reflect per-transaction scope and keep the previous behavior, or (b) explicitly 
caching the computed result outside the loop / back into the shared variable 
when appropriate.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to