You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Adam Saghy (Jira)" <ji...@apache.org> on 2026/10/15 10:58:00 UTC

[jira] [Assigned] (FINERACT-2954) ArithmeticException (Division by zero) in flat-rate schedule generation when principal variation falls on last installment

     [ https://issues.apache.org/jira/browse/FINERACT-2954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Saghy reassigned FINERACT-2954:
------------------------------------

    Assignee:     (was: Adam Saghy)

> ArithmeticException (Division by zero) in flat-rate schedule generation when principal variation falls on last installment
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2954
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2954
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Loan
>            Reporter: Senesh Perera
>            Priority: Major
>
> *Description*
> During flat-rate loan schedule generation and recalculation, an `ArithmeticException` (division by zero) occurs if a `PRINCIPAL_AMOUNT` term variation is applicable on the final installment period (where `periodNumber == actualNumberOfRepayments`).
> *Root Cause Analysis*
> In `LoanApplicationTerms.java`, the method `calculateTotalPrincipalPerPeriodWithoutGrace` computes schedule adjustments for flat loans:
> {code:java}
> if (!isPrincipalGraceApplicableForThisPeriod(periodNumber) && currentPeriodFixedPrincipalAmount != null) {
>     this.adjustPrincipalForFlatLoans = this.adjustPrincipalForFlatLoans.plus(principalPerPeriod
>             .minus(currentPeriodFixedPrincipalAmount).dividedBy(this.actualNumberOfRepayments - periodNumber, mc));
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)