Vladyslav Samchenko created FINERACT-2906:
---------------------------------------------

             Summary: SmsDataValidator does not reject a null staffId on SMS 
creation
                 Key: FINERACT-2906
                 URL: https://issues.apache.org/jira/browse/FINERACT-2906
             Project: Apache Fineract
          Issue Type: Bug
            Reporter: Vladyslav Samchenko
            Assignee: Vladyslav Samchenko


{{SmsDataValidator.validateForCreate}} accepts a JSON payload containing an 
explicit {{"staffId": null}} without raising a validation error. However, the 
only consumer of this validator, {{{}SmsMessageAssembler{}}}, cannot handle a 
null {{{}staffId{}}}: it unconditionally calls 
{{{}StaffRepositoryWrapper.findOneWithNotFoundDetection(null){}}}, which fails 
with an {{IllegalArgumentException}} from Spring Data's {{Assert.notNull}} 
rather than a domain-specific validation exception.

The two components are inconsistent. Either {{staffId = null}} is a valid 
input, in which case the assembler must handle it, or it is invalid, in which 
case the validator must reject it. They cannot both be correct, so at least one 
component is defective regardless of the original intent.



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

Reply via email to