Source:
<code>public String getCorePropertiesText() { POIXMLDocument document = getDocument(); if (document == null) { return ""; } StringBuilder text = new StringBuilder(64); PackagePropertiesPart props = document.getProperties().getCoreProperties().getUnderlyingProperties(); appendIfPresent(text, "Category", props.getCategoryProperty()); appendIfPresent(text, "Category", props.getCategoryProperty()); appendIfPresent(text, "ContentStatus", props.getContentStatusProperty()); appendIfPresent(text, "ContentType", props.getContentTypeProperty()); appendIfPresent(text, "Created", props.getCreatedProperty().orElse(null)); appendIfPresent(text, "CreatedString", props.getCreatedPropertyString()); appendIfPresent(text, "Creator", props.getCreatorProperty()); appendIfPresent(text, "Description", props.getDescriptionProperty()); appendIfPresent(text, "Identifier", props.getIdentifierProperty()); appendIfPresent(text, "Keywords", props.getKeywordsProperty()); appendIfPresent(text, "Language", props.getLanguageProperty()); appendIfPresent(text, "LastModifiedBy", props.getLastModifiedByProperty()); appendIfPresent(text, "LastPrinted", props.getLastPrintedProperty().orElse(null)); appendIfPresent(text, "LastPrintedString", props.getLastPrintedPropertyString()); <START> appendIfPresent(text, "Modified", props.getModifiedProperty().orElse(null)); <END> appendIfPresent(text, "ModifiedString", props.getModifiedPropertyString()); appendIfPresent(text, "Revision", props.getRevisionProperty()); appendIfPresent(text, "Subject", props.getSubjectProperty()); appendIfPresent(text, "Title", props.getTitleProperty()); appendIfPresent(text, "Version", props.getVersionProperty()); return text.toString(); }</code><technical_language>some lines .orElse(null) don't? worth effort define some appendIfPresent for Optional<Date>, least</technical_language>

Target:
public String getCorePropertiesText() { POIXMLDocument document = getDocument(); if (document == null) { return ""; } StringBuilder text = new StringBuilder(64); PackagePropertiesPart props = document.getProperties().getCoreProperties().getUnderlyingProperties(); appendIfPresent(text, "Category", props.getCategoryProperty()); appendIfPresent(text, "Category", props.getCategoryProperty()); appendIfPresent(text, "ContentStatus", props.getContentStatusProperty()); appendIfPresent(text, "ContentType", props.getContentTypeProperty()); appendDateIfPresent(text, "Created", props.getCreatedProperty()); appendIfPresent(text, "CreatedString", props.getCreatedPropertyString()); appendIfPresent(text, "Creator", props.getCreatorProperty()); appendIfPresent(text, "Description", props.getDescriptionProperty()); appendIfPresent(text, "Identifier", props.getIdentifierProperty()); appendIfPresent(text, "Keywords", props.getKeywordsProperty()); appendIfPresent(text, "Language", props.getLanguageProperty()); appendIfPresent(text, "LastModifiedBy", props.getLastModifiedByProperty()); appendDateIfPresent(text, "LastPrinted", props.getLastPrintedProperty()); appendIfPresent(text, "LastPrintedString", props.getLastPrintedPropertyString()); appendDateIfPresent(text, "Modified", props.getModifiedProperty()); appendIfPresent(text, "ModifiedString", props.getModifiedPropertyString()); appendIfPresent(text, "Revision", props.getRevisionProperty()); appendIfPresent(text, "Subject", props.getSubjectProperty()); appendIfPresent(text, "Title", props.getTitleProperty()); appendIfPresent(text, "Version", props.getVersionProperty()); return text.toString(); }