Skip to content

Commit

Permalink
Merge pull request mosip#24 from ase-101/develop
Browse files Browse the repository at this point in the history
ES-1456
  • Loading branch information
ase-101 authored Aug 23, 2024
2 parents cf8fe5f + ab57d11 commit e450377
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ public void validate(String action, ProfileDto profileDto) throws InvalidProfile
Iterator itr = requiredFieldIds.iterator();
while (itr.hasNext()) {
String fieldName = ((TextNode)itr.next()).textValue();
if(ID_SCHEMA_VERSION_FIELD_ID.equals(fieldName))
continue;

if (inputJson.get(fieldName) == null || StringUtils.isEmpty(inputJson.get(fieldName).textValue())
|| StringUtils.containsWhitespace(inputJson.get(fieldName).textValue())) {
if (inputJson.get(fieldName) == null) {
log.error("Null/Empty value found in the required field of {}, required: {}", fieldName, requiredFieldIds);
throw new InvalidProfileException("invalid_".concat(fieldName.toLowerCase()));
}
Expand Down Expand Up @@ -413,7 +409,8 @@ private String getUTCDateTime() {
}

private void validateValue(String keyName, SchemaFieldValidator validator, String value) {
if(value == null || value.isEmpty())
log.info("Validate field : {} with value : {} using validator : {}", keyName, value, validator.getValidator());
if(value == null || value.trim().isEmpty())
throw new InvalidProfileException("invalid_".concat(keyName.toLowerCase()));

if( validator != null && "regex".equalsIgnoreCase(validator.getType()) && !value.matches(validator.getValidator()) ) {
Expand Down

0 comments on commit e450377

Please sign in to comment.