Description
Getting a NullPointerException during the creation of a Loan for a client.
The problem seems to come when the LoanProductData.isInterestRecalculationEnabled is false and calling the LoadProductData.isCompoundingToBePostedAsTransaction() method where it would call the interestRecalculationData which is null.
It seems reasonable to be null as the interest recalculation is not enabled.
There was a commit:
commit af0dd7e5f3856eb0fc5b7441c8ec51941e1764d1 Author: Awasum Yannick Date: 10/12/2019, 17:37 use SpotBugs & fix over 300 high priority rule violations (FINERACT-702) This PR also serves as a base solution for upcoming FINERACT-712 and FINERACT-696. It includes using Objects.equals() to prevent NPEs, and adding gradle check to run SpotBugs on Travis CI. PS: SpotBugs is the successor to (and same code as) FindBugs.
which changed the business logic but my theory is that it might be a mistake.
Before the commit:
if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.isCompoundingToBePostedAsTransaction(); } return null;
After the commit:
if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.isCompoundingToBePostedAsTransaction(); } return !this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
The NPE is coming for the below line:
return !this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
Could you please validate my theory?
Attachments
Issue Links
- links to