[
https://issues.apache.org/jira/browse/FINERACT-2593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18075731#comment-18075731
]
Ashhar Ahmad Khan commented on FINERACT-2593:
---------------------------------------------
I have upcoming university exams and won't be able to work on this immediately.
If anyone wants to pick it up, please feel free. Otherwise I'll continue to
implement this once my exams conclude.
> NullPointerException in calculateLoanCollectionData and
> calculateAvailableDisbursementAmountWithOverApplied when LoanProduct is null
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: FINERACT-2593
> URL: https://issues.apache.org/jira/browse/FINERACT-2593
> Project: Apache Fineract
> Issue Type: Bug
> Reporter: Ashhar Ahmad Khan
> Priority: Major
>
> `DelinquencyReadPlatformServiceImpl` contains an inverted null guard in
> `calculateLoanCollectionData` that routes loans with a null `LoanProduct`
> reference directly into `calculateAvailableDisbursementAmountWithOverApplied`,
> which dereferences `loanProduct` without any null check, producing an
> unhandled
> `NullPointerException` surfaced as HTTP 500.
> The condition `getLoanProduct() == null ||` evaluates to `true` when
> `getLoanProduct()` returns null, causing the helper to be called rather than
> skipped. The intended operator is `!= null &&`.
> The active loan branch within the same method also calls the helper with no
> guard at all. The helper itself must additionally be made self-defensive since
> it is declared on the public `DelinquencyReadPlatformService` interface and is
> invoked directly by `retrieveApprovalTemplate` and `retrieveDisbursalTemplate`
> in `LoanReadPlatformServiceImpl` without any null check at those call sites —
> giving five independent crash surfaces from the same root cause.
> `calculateLoanCollectionData` currently has no unit test coverage in
> `DelinquencyReadPlatformServiceImplTest`. Four constructor-injected fields
> also
> lack `@Mock` declarations, causing silent Mockito injection failure on any new
> tests written for this path.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)