oleksii-novikov-onix commented on PR #5865:
URL: https://github.com/apache/fineract/pull/5865#issuecomment-4563231960

   > One thing I'm not sure about in the validator change.
   > 
   > `WorkingCapitalLoanDataValidator.java`:
   > 
   > ```java
   > -        if (expectedDisbursementDate != null && approvedOnDate != null && 
DateUtils.isBefore(expectedDisbursementDate, approvedOnDate)) {
   > +        if (expectedDisbursementDate != null && 
DateUtils.isBefore(expectedDisbursementDate, approvedOnDate)) {
   > ```
   > 
   > Why remove the `approvedOnDate != null` guard? In `validateApproval` the 
error accumulation pattern means `approvedOnDate` can still be null past the 
`notNull()` check (the error is collected, not thrown). If the caller omits 
`approvedOnDate`, `DateUtils.isBefore(date, null)` will NPE rather than 
producing a proper validation error.
   
   Hello Arnold, DateUtils.isBefore is null-safe on both arguments, when the 
second argument is null, it returns false.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to