From 4748f690c219b052f1b6fc578ac2a4576fc521bc Mon Sep 17 00:00:00 2001 From: Richard Richter Date: Sat, 30 May 2020 13:30:23 +0200 Subject: [PATCH] DefaultColumnUtils: Joda date formatting replaced with JDK 8 API --- model/model-common/pom.xml | 6 ------ .../midpoint/model/common/util/DefaultColumnUtils.java | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/model/model-common/pom.xml b/model/model-common/pom.xml index f11628d0ce2..e70efdc67ae 100644 --- a/model/model-common/pom.xml +++ b/model/model-common/pom.xml @@ -149,12 +149,6 @@ com.google.guava guava - - - joda-time - joda-time - - org.codehaus.groovy diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/util/DefaultColumnUtils.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/util/DefaultColumnUtils.java index f20ee33cc94..3de32c65d7e 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/util/DefaultColumnUtils.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/util/DefaultColumnUtils.java @@ -8,13 +8,13 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.time.format.FormatStyle; import java.util.*; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import com.google.common.collect.ImmutableMap; import org.jetbrains.annotations.Nullable; -import org.joda.time.format.DateTimeFormat; import com.evolveum.midpoint.audit.api.AuditEventRecord; import com.evolveum.midpoint.common.LocalizationService; @@ -334,8 +334,11 @@ public static String processSpecialColumn( if (itemPath.equivalent(TaskType.F_COMPLETION_TIMESTAMP)) { XMLGregorianCalendar timestamp = task.getCompletionTimestamp(); if (timestamp != null && task.getExecutionStatus().equals(TaskExecutionStatusType.CLOSED)) { - String pattern = DateTimeFormat.patternForStyle("SM", Locale.getDefault()); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); + // Do we want default locale or default locale for FORMAT category? + // For latter no .withLocale() would be needed. + DateTimeFormatter formatter = DateTimeFormatter + .ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM) + .withLocale(Locale.getDefault()); ZonedDateTime time = timestamp.toGregorianCalendar().toZonedDateTime(); String dateTime = formatter.format(time); String key = "pageTasks.task.closedAt";