Skip to content

Commit

Permalink
added null check to extractEventDateFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb committed Jan 25, 2024
1 parent da76040 commit 720f12d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/emissary/output/DropOffUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 720f12d

Please sign in to comment.