DATACMNS-1618 - Set log level for potentially unsupported custom conversion target type to debug.

Original pull request: #416.
This commit is contained in:
Christoph Strobl
2019-11-18 10:01:15 +01:00
committed by Mark Paluch
parent d2a581e9e3
commit de917b9f99

View File

@@ -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.