@@ -303,7 +303,7 @@ private static Instant getDateTimeFromItem(Item item, String dateTimeFormat)
303303 throws DateTimeParseException {
304304 Optional <String > pubDate = item .getPubDate ();
305305
306- return pubDate .map (s -> getInstantTimeFromFormat (s , dateTimeFormat )).orElse (Instant .MIN );
306+ return pubDate .map (s -> parseDateTime (s , dateTimeFormat )).orElse (Instant .MIN );
307307
308308 }
309309
@@ -325,7 +325,7 @@ private static boolean isValidDateFormat(Item rssItem, RSSFeed feedConfig) {
325325 // If this throws a DateTimeParseException then it's certain
326326 // that the format pattern defined in the config and the
327327 // feed's actual format differ.
328- getInstantTimeFromFormat (firstRssFeedPubDate .get (), feedConfig .dateFormatterPattern ());
328+ parseDateTime (firstRssFeedPubDate .get (), feedConfig .dateFormatterPattern ());
329329 } catch (DateTimeParseException _) {
330330 return false ;
331331 }
@@ -374,8 +374,8 @@ private MessageCreateData constructMessage(Item item, RSSFeed feedConfig) {
374374
375375 // Set the item's timestamp to the embed if found
376376 item .getPubDate ()
377- .ifPresent (date -> embedBuilder
378- .setTimestamp (getInstantTimeFromFormat ( date , feedConfig .dateFormatterPattern ())));
377+ .ifPresent (dateTime -> embedBuilder
378+ .setTimestamp (parseDateTime ( dateTime , feedConfig .dateFormatterPattern ())));
379379
380380 embedBuilder .setTitle (title , titleLink );
381381 embedBuilder .setAuthor (item .getChannel ().getLink ());
@@ -434,17 +434,17 @@ private List<Item> fetchRSSItemsFromURL(String rssUrl) {
434434 /**
435435 * Helper function for parsing a given date value to a {@link Instant} with a given format.
436436 *
437- * @param date the date value to parse, can be null
437+ * @param dateTime the date and time value to parse, can be null
438438 * @return the parsed {@link Instant} object
439439 * @throws DateTimeParseException if the date cannot be parsed
440440 */
441- private static Instant getInstantTimeFromFormat (@ Nullable String date , String datePattern )
441+ private static Instant parseDateTime (@ Nullable String dateTime , String datePattern )
442442 throws DateTimeParseException {
443- if (date == null ) {
443+ if (dateTime == null ) {
444444 return Instant .MIN ;
445445 }
446446
447- return Instant .from (DateTimeFormatter .ofPattern (datePattern ).parse (date ));
447+ return Instant .from (DateTimeFormatter .ofPattern (datePattern ).parse (dateTime ));
448448 }
449449
450450 private long calculateWaitHours (int failureCount ) {
0 commit comments