Improved null value Handling on WordBuilder

This commit is contained in:
George Kalampokis 2020-02-26 13:37:54 +02:00
parent 2b30d4e2d2
commit e26db8e4c4
1 changed files with 8 additions and 6 deletions

View File

@ -136,7 +136,11 @@ public class WordBuilder {
private void createPages(List<DatasetProfilePage> datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) {
datasetProfilePages.forEach(item -> {
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService);
try {
createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
});
}
@ -258,7 +262,7 @@ public class WordBuilder {
}
return sb.toString();
} else if (comboboxType.equals("wordlist")) {
return field.getValue().toString();
return field.getValue() != null ? field.getValue().toString() : "";
}
}
case "booleanDecision":
@ -271,11 +275,9 @@ public class WordBuilder {
if (field.getValue() == null || field.getValue().equals("false")) return null;
return data.getLabel();
case "freetext":
return field.getValue().toString();
case "textarea":
return field.getValue().toString();
case "datepicker":
return field.getValue().toString();
case "textarea":
return field.getValue() != null ? field.getValue().toString(): "";
}
return null;
}