From 8c73d8187bdc6de385f2160cb127d50c2665dcf8 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 13 Dec 2021 18:11:44 +0100 Subject: [PATCH] Add more traces when converting dates --- .../crawler/fs/client/WorkplaceSearchClientUtil.java | 5 +++++ .../crawler/fs/client/WorkplaceSearchClientUtilTest.java | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtil.java b/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtil.java index c136fd782..7f02ea1d9 100644 --- a/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtil.java +++ b/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtil.java @@ -149,6 +149,11 @@ public static String generateDefaultCustomSourceName(String suffix) { } public static String toRFC3339(Date d) { + if (logger.isDebugEnabled() && d != null) { + String format = RFC_3339.format(d); + String finalDate = format.replaceAll("(\\d\\d)(\\d\\d)$", "$1:$2"); + logger.debug("Transforming date to RFC_3339 [{}] -> [{}] -> [{}]", d, format, finalDate); + } return d == null ? null : RFC_3339.format(d).replaceAll("(\\d\\d)(\\d\\d)$", "$1:$2"); } diff --git a/elasticsearch-client/elasticsearch-client-base/src/test/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtilTest.java b/elasticsearch-client/elasticsearch-client-base/src/test/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtilTest.java index 545ea0e37..71e77b815 100644 --- a/elasticsearch-client/elasticsearch-client-base/src/test/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtilTest.java +++ b/elasticsearch-client/elasticsearch-client-base/src/test/java/fr/pilato/elasticsearch/crawler/fs/client/WorkplaceSearchClientUtilTest.java @@ -22,7 +22,6 @@ import fr.pilato.elasticsearch.crawler.fs.test.framework.AbstractFSCrawlerTestCase; import org.junit.Test; -import java.text.ParseException; import java.util.Date; import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiAlphanumOfLength;