Uploaded image for project: 'Apache Fineract'
  1. Apache Fineract
  2. FINERACT-839

NPE when creating a Loan for a client

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: Client
    • Labels:
      None

      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

            Activity

              People

              • Assignee:
                adamsaghy Adam Saghy
                Reporter:
                adamsaghy Adam Saghy
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m