]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9721 Remove DateUtils#formatDate(Long)
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 28 Aug 2017 14:55:50 +0000 (16:55 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Wed, 30 Aug 2017 14:24:53 +0000 (16:24 +0200)
server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java
sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java

index 73b5890662a6d5f5a87243712aced55730626301..858dd452952268571ac46d0de42fe3db8de6d3a2 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.server.telemetry;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.io.IOException;
 import java.io.StringWriter;
+import java.util.Date;
 import java.util.Optional;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
@@ -145,7 +146,7 @@ public class TelemetryDaemon implements Startable {
   }
 
   private static long startOfDay(long now) {
-    return parseDate(formatDate(now)).getTime();
+    return parseDate(formatDate(new Date(now))).getTime();
   }
 
   private int frequency() {
index aa326dce1d027122f845a89c17d140c3af8ffda5..d226fe6270a2845ae2665843c5cdda6fb2c179d6 100644 (file)
@@ -54,10 +54,6 @@ public final class DateUtils {
     return THREAD_SAFE_DATE_FORMAT.format(d);
   }
 
-  public static String formatDate(long ms) {
-    return THREAD_SAFE_DATE_FORMAT.format(new Date(ms));
-  }
-
   public static String formatDateTime(Date d) {
     return THREAD_SAFE_DATETIME_FORMAT.format(d);
   }
index 0dd1ed07292efdc9696e3b39ef19d347015a2cef..cda37e7996f8b725db24c9fbfccf6c9268803aac 100644 (file)
@@ -103,9 +103,7 @@ public class DateUtilsTest {
   @Test
   public void shouldFormatDate() {
     assertThat(DateUtils.formatDate(new Date())).startsWith("20");
-    assertThat(DateUtils.formatDate(new Date().getTime())).startsWith("20");
     assertThat(DateUtils.formatDate(new Date()).length()).isEqualTo(10);
-    assertThat(DateUtils.formatDate(new Date().getTime()).length()).isEqualTo(10);
   }
 
   @Test