catch error when a field's external api is not available and interrupts prefilling process

This commit is contained in:
Bernaldo Mihasi 2023-06-26 14:16:41 +03:00
parent 8fbc20c823
commit 1c0562d7e7
1 changed files with 7 additions and 1 deletions

View File

@ -203,7 +203,13 @@ public class PrefillingMapper {
AutoCompleteData autoCompleteData = mapper.treeToValue(dataNode, AutoCompleteData.class);
isMultiSelect = autoCompleteData.getMultiAutoComplete();
for (String format : parsedValues) {
List<ExternalAutocompleteFieldModel> result = DatasetProfileManager.getAutocomplete(autoCompleteData, format);
List<ExternalAutocompleteFieldModel> result = new ArrayList<>();
try {
result = DatasetProfileManager.getAutocomplete(autoCompleteData, format);
}
catch (Exception e) {
logger.error(e.getMessage(), e);
}
result = result.stream().filter(StreamDistinctBy.distinctByKey(ExternalAutocompleteFieldModel::getId)).collect(Collectors.toList());
if(!result.isEmpty()){
List<String> tempValues = new LinkedList<>();