From c5d4e01f6dd806743e7d57c7802340d365716ffe Mon Sep 17 00:00:00 2001 From: anto Date: Wed, 1 Jul 2020 08:09:36 +0100 Subject: [PATCH] chore: improve logging when falling back to DateUtils.parseDate --- .../au/com/dius/pact/core/matchers/MatcherExecutor.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/MatcherExecutor.kt b/core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/MatcherExecutor.kt index 5b1b51a3f4..27176e9f4e 100755 --- a/core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/MatcherExecutor.kt +++ b/core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/MatcherExecutor.kt @@ -354,9 +354,10 @@ fun matchDateTime( } catch (e: DateTimeParseException) { try { logger.warn { - """Unable to parse ${valueOf(actual)} with $pattern using java.time.format.DateTimeFormatter. - Attempting to parse using org.apache.commons.lang3.time.DateUtils - to guarantee backwards compatibility with versions < 4.1.1. + """Failed to parse ${valueOf(actual)} with '$pattern' using java.time.format.DateTimeFormatter. + Exception was: ${e.message}. + Will attempt to parse using org.apache.commons.lang3.time.DateUtils to guarantee backwards + compatibility with versions < 4.1.1. Please update your patterns in your pact tests as this may not be supported in future versions.""" } DateUtils.parseDate(safeToString(actual), pattern)