From c35a38ea003ecfabccd079a0060d4b4b0e221b3c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 30 May 2013 18:25:31 +0200 Subject: [PATCH] Dates of past analysis must not contain milliseconds --- .../org/sonar/batch/components/PastSnapshot.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshot.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshot.java index 666aab37d81..e252433c3ff 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshot.java +++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshot.java @@ -25,6 +25,8 @@ import org.sonar.api.CoreProperties; import org.sonar.api.database.model.Snapshot; import org.sonar.api.utils.DateUtils; +import javax.annotation.Nullable; +import java.util.Calendar; import java.util.Date; public class PastSnapshot { @@ -32,15 +34,17 @@ public class PastSnapshot { private int index; private String mode, modeParameter; private Snapshot projectSnapshot; - private Date targetDate; + private Date targetDate = null; - public PastSnapshot(String mode, Date targetDate, Snapshot projectSnapshot) { + public PastSnapshot(String mode, @Nullable Date targetDate, @Nullable Snapshot projectSnapshot) { this.mode = mode; - this.targetDate = targetDate; + if (targetDate != null) { + this.targetDate = org.apache.commons.lang.time.DateUtils.truncate(targetDate, Calendar.SECOND); + } this.projectSnapshot = projectSnapshot; } - public PastSnapshot(String mode, Date targetDate) { + public PastSnapshot(String mode, @Nullable Date targetDate) { this(mode, targetDate, null); } -- 2.39.5