DATACMNS-1336 - Avoid warning logs for JodaTime and ThreeTenBP converter registrations.
Removed the explicit registration for JodaTime and ThreeTenBP to JSR-310 converters (originally introduced to support the unifying lookup of the last modified date in the auditing subsystem) as reading converters. This avoids the warning reporting that the source types (JodaTime and ThreeTenBP LocalDateTime) not being store-native types (which usually indicates a superfluous converter registration). Updated the test cases to make sure these warnings aren't trigger due to test setups causing the same issue.
This commit is contained in:
@@ -75,7 +75,6 @@ public abstract class JodaTimeConverters {
|
||||
return converters;
|
||||
}
|
||||
|
||||
@ReadingConverter
|
||||
public enum LocalDateTimeToJsr310Converter implements Converter<LocalDateTime, java.time.LocalDateTime> {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
@@ -53,6 +53,14 @@ public abstract class ThreeTenBackPortConverters {
|
||||
|
||||
private static final boolean THREE_TEN_BACK_PORT_IS_PRESENT = ClassUtils.isPresent("org.threeten.bp.LocalDateTime",
|
||||
ThreeTenBackPortConverters.class.getClassLoader());
|
||||
private static final Collection<Class<?>> SUPPORTED_TYPES;
|
||||
|
||||
static {
|
||||
|
||||
SUPPORTED_TYPES = THREE_TEN_BACK_PORT_IS_PRESENT //
|
||||
? Arrays.asList(LocalDateTime.class, LocalDate.class, LocalTime.class, Instant.class, java.time.Instant.class)
|
||||
: Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the converters to be registered. Will only return converters in case we're running on Java 8.
|
||||
@@ -84,16 +92,9 @@ public abstract class ThreeTenBackPortConverters {
|
||||
}
|
||||
|
||||
public static boolean supports(Class<?> type) {
|
||||
|
||||
if (!THREE_TEN_BACK_PORT_IS_PRESENT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Arrays.<Class<?>> asList(LocalDateTime.class, LocalDate.class, LocalTime.class, Instant.class, java.time.Instant.class)
|
||||
.contains(type);
|
||||
return SUPPORTED_TYPES.contains(type);
|
||||
}
|
||||
|
||||
@ReadingConverter
|
||||
public static enum LocalDateTimeToJsr310LocalDateTimeConverter
|
||||
implements Converter<LocalDateTime, java.time.LocalDateTime> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user