You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/06/01 15:33:49 UTC

[GitHub] [fineract] maektwain opened a new pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

maektwain opened a new pull request #960:
URL: https://github.com/apache/fineract/pull/960


   ## Description
   Describe the changes made and why they were made. Ignore if these details are present on the associated Jira ticket
   
   ## Checklist
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Commit message starts with the issue number from https://issues.apache.org/jira/projects/FINERACT/. Ex: FINERACT-646 Pockets API.
   
   - [ ] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
   
   - [ ] API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm has been updated with details of any API changes.
   
   - [ ] Integration tests have been created/updated for verifying the changes made.
   
   - [ ] All Integrations tests are passing with the new commits.
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the list.)
   
   Our guidelines for code reviews is at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger commented on a change in pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
vorburger commented on a change in pull request #960:
URL: https://github.com/apache/fineract/pull/960#discussion_r433621124



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
##########
@@ -636,10 +637,12 @@ private void updateAmountsBasedOnCurrentEarlyPayments(final MathContext mc, fina
                     scheduleParams.getReducePrincipal(),
                     scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod())
                             .plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc));
-            if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
-                    && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
-                currentPeriodParams.setEmiAmountChanged(true);
-            }
+          if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
+            && fixedEmiAmount != null
+            && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
+            currentPeriodParams.setEmiAmountChanged(true);
+            currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());

Review comment:
       Whoa! @maektwain hang on - you probably mistakenly added this extra duplicate line here, right?  :sob:  Or was this intentional, and I'm not getting it? I'm proposing to remove it again in #967... do you agree? (I'm not sure if it's causing FINERACT-855 or if that's an unrelated problem.)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] maektwain commented on a change in pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
maektwain commented on a change in pull request #960:
URL: https://github.com/apache/fineract/pull/960#discussion_r433639248



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
##########
@@ -636,10 +637,12 @@ private void updateAmountsBasedOnCurrentEarlyPayments(final MathContext mc, fina
                     scheduleParams.getReducePrincipal(),
                     scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod())
                             .plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc));
-            if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
-                    && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
-                currentPeriodParams.setEmiAmountChanged(true);
-            }
+          if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
+            && fixedEmiAmount != null
+            && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
+            currentPeriodParams.setEmiAmountChanged(true);
+            currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());

Review comment:
       Should I remove this? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] maektwain commented on a change in pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
maektwain commented on a change in pull request #960:
URL: https://github.com/apache/fineract/pull/960#discussion_r433639461



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
##########
@@ -636,10 +637,12 @@ private void updateAmountsBasedOnCurrentEarlyPayments(final MathContext mc, fina
                     scheduleParams.getReducePrincipal(),
                     scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod())
                             .plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc));
-            if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
-                    && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
-                currentPeriodParams.setEmiAmountChanged(true);
-            }
+          if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
+            && fixedEmiAmount != null
+            && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
+            currentPeriodParams.setEmiAmountChanged(true);
+            currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());

Review comment:
       ? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] maektwain commented on pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
maektwain commented on pull request #960:
URL: https://github.com/apache/fineract/pull/960#issuecomment-636926403


   This could be merged if no errors in  case @vorburger 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger merged pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
vorburger merged pull request #960:
URL: https://github.com/apache/fineract/pull/960


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vorburger commented on a change in pull request #960: FINERACT-977-fix possible NPE in AbstractLoanScheduleGenerator

Posted by GitBox <gi...@apache.org>.
vorburger commented on a change in pull request #960:
URL: https://github.com/apache/fineract/pull/960#discussion_r433653361



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
##########
@@ -636,10 +637,12 @@ private void updateAmountsBasedOnCurrentEarlyPayments(final MathContext mc, fina
                     scheduleParams.getReducePrincipal(),
                     scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod())
                             .plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc));
-            if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
-                    && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
-                currentPeriodParams.setEmiAmountChanged(true);
-            }
+          if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
+            && fixedEmiAmount != null
+            && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
+            currentPeriodParams.setEmiAmountChanged(true);
+            currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());

Review comment:
       This PR is already merged, so I have raised new #967, could you please confirm there if that one looks good to you, if you agree that this was wrong?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org