[ 
https://issues.apache.org/jira/browse/FINERACT-839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17021961#comment-17021961
 ] 

Adam Saghy commented on FINERACT-839:
-------------------------------------

Raise PR: [https://github.com/apache/fineract/pull/696]

> NPE when creating a Loan for a client
> -------------------------------------
>
>                 Key: FINERACT-839
>                 URL: https://issues.apache.org/jira/browse/FINERACT-839
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 1.4.0
>            Reporter: Adam Saghy
>            Priority: Blocker
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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:
>  
> {code:java}
> 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.{code}
> which changed the business logic but my theory is that it might be a mistake.
>  
> Before the commit:
>  
> {code:java}
> if (isInterestRecalculationEnabled()) {
>  return this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
> }
> return null;
> {code}
>  
> After the commit:
>  
> {code:java}
> if (isInterestRecalculationEnabled()) {
>  return this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
> } 
> return 
> !this.interestRecalculationData.isCompoundingToBePostedAsTransaction();{code}
>  
> The NPE is coming for the below line:
>  
> {code:java}
> return 
> !this.interestRecalculationData.isCompoundingToBePostedAsTransaction();{code}
>  
>  
> Could you please validate my theory?
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to