From 720f12dc77d2ebe39569d6a16e18c88c2c49a0ab Mon Sep 17 00:00:00 2001 From: dev-mlb <19797865+dev-mlb@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:31:51 -0500 Subject: [PATCH] added null check to extractEventDateFrom --- src/main/java/emissary/output/DropOffUtil.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/emissary/output/DropOffUtil.java b/src/main/java/emissary/output/DropOffUtil.java index 6d56482aa5..41d38d88b2 100755 --- a/src/main/java/emissary/output/DropOffUtil.java +++ b/src/main/java/emissary/output/DropOffUtil.java @@ -23,6 +23,7 @@ import java.security.SecureRandom; import java.text.SimpleDateFormat; import java.time.Instant; +import java.time.ZonedDateTime; import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.Collection; @@ -888,8 +889,13 @@ public Date extractEventDateFrom(final IBaseDataObject d, final boolean lastReso final String value = d.getStringParameter(paramName); if (value != null) { try { - return Date.from(FlexibleDateTimeParser.parse(value, DATE_ISO_8601).toInstant()); - } catch (DateTimeParseException | NullPointerException ex) { + ZonedDateTime zdt = FlexibleDateTimeParser.parse(value, DATE_ISO_8601); + if (zdt == null) { + logger.debug("FlexibleDateTimeParser returned null trying to parse EventDate"); + } else { + return Date.from(zdt.toInstant()); + } + } catch (DateTimeParseException ex) { logger.debug("Cannot parse EventDate", ex); } }