Date (@Nullable String value, boolean logError) { if (value == null) return null; try { return Date.from(Instant.parse(value)); } catch (DateTimeParseException | ArithmeticException e) { if (logError) { LOG.error("Could not parse date " + value, e); } return null; } }