From de917b9f99dd69407f669b86dd37af55358f0a67 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Mon, 18 Nov 2019 10:01:15 +0100 Subject: [PATCH] DATACMNS-1618 - Set log level for potentially unsupported custom conversion target type to debug. Original pull request: #416. --- .../data/convert/CustomConversions.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springframework/data/convert/CustomConversions.java b/src/main/java/org/springframework/data/convert/CustomConversions.java index a52e0a249..427f01a69 100644 --- a/src/main/java/org/springframework/data/convert/CustomConversions.java +++ b/src/main/java/org/springframework/data/convert/CustomConversions.java @@ -214,11 +214,23 @@ public class CustomConversions { customSimpleTypes.add(pair.getSourceType()); if (LOG.isWarnEnabled() && !converterRegistration.isSimpleTargetType()) { - LOG.warn(String.format(WRITE_CONVERTER_NOT_SIMPLE, pair.getSourceType(), pair.getTargetType())); + + String msg = String.format(WRITE_CONVERTER_NOT_SIMPLE, pair.getSourceType(), pair.getTargetType()); + if (isJavaTimeType(pair.getTargetType())) { + + // TODO: this is a temporary fix seeking a better solution for 2.3 + LOG.debug(msg); + } else { + LOG.warn(msg); + } } } } + private boolean isJavaTimeType(Class type) { + return type.getName().startsWith("java.time"); + } + /** * Returns the target type to convert to in case we have a custom conversion registered to convert the given source * type into a Mongo native one.