Abhishek Chaudhary created FINERACT-2914:
--------------------------------------------

             Summary: Execute Standing Instruction job fails or skips months 
when the recurrence day is 29-31
                 Key: FINERACT-2914
                 URL: https://issues.apache.org/jira/browse/FINERACT-2914
             Project: Apache Fineract
          Issue Type: Bug
          Components: Job Scheduler, Savings
    Affects Versions: 1.15.0
            Reporter: Abhishek Chaudhary
             Fix For: 1.16.0


{{ExecuteStandingInstructionsTasklet}} works out the first due date of a 
monthly or yearly standing instruction with 
{{validFrom.withDayOfMonth(recurrenceOnDay)}}. The API accepts any 
{{recurrenceOnMonthDay}} (it is only checked for not null), so this goes wrong 
in two ways.

# *The job fails for all instructions.* If {{validFrom}} falls in a month 
shorter than the recurrence day, {{withDayOfMonth}} throws 
{{DateTimeException}} (for example {{Invalid date 'APRIL 31'}} for day 31 
starting in April, or {{Invalid date 'FEBRUARY 30'}}). The exception is not 
caught, so the job fails and the remaining instructions are not processed. 
{{validFrom}} does not change, so the job fails on every run while the 
instruction is active.
# *Shorter months are skipped silently.* The due check compares 
{{start.plusMonths(MONTHS.between(start, today))}} with today. 
{{MONTHS.between}} truncates, so a monthly instruction on the 31st never 
matches on Feb 28/29, Apr 30, Jun 30, Sep 30 or Nov 30. It runs only 7 times a 
year. A yearly instruction on 29 February runs only in leap years. No error is 
logged.

*Expected:* when the month is shorter than the recurrence day, the instruction 
runs on the last day of that month, the way savings charges do 
({{SavingsAccountCharge}} clamps {{feeOnDay}} to the month length). One 
instruction must not stop the job for the others.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to