From bd9672b8fecbd733f08831f4baa96718b7531b8f Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Wed, 17 Dec 2014 14:01:37 +0100 Subject: [PATCH] =?utf8?q?purge=20=E2=80=93=20specify=20contract=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sonar/core/computation/dbcleaner/ProjectCleaner.java | 6 ++++-- .../main/java/org/sonar/core/purge/PurgeConfiguration.java | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java index cfe0c2646bb..64e876e20b5 100644 --- a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java +++ b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java @@ -26,13 +26,15 @@ import org.sonar.api.CoreProperties; import org.sonar.api.ServerComponent; import org.sonar.api.config.Settings; import org.sonar.api.utils.TimeUtils; +import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner; import org.sonar.core.persistence.DbSession; import org.sonar.core.purge.*; -import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.properties.ProjectSettingsFactory; import org.sonar.server.search.IndexClient; +import javax.annotation.Nullable; + import java.util.Date; import static org.sonar.core.purge.PurgeConfiguration.newDefaultPurgeConfiguration; @@ -73,7 +75,7 @@ public class ProjectCleaner implements ServerComponent { return this; } - private void deleteIndexedIssuesBefore(String uuid, Date lastDateWithClosedIssues) { + private void deleteIndexedIssuesBefore(String uuid, @Nullable Date lastDateWithClosedIssues) { if (lastDateWithClosedIssues != null) { indexClient.get(IssueIndex.class).deleteClosedIssuesOfProjectBefore(uuid, lastDateWithClosedIssues); } diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeConfiguration.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeConfiguration.java index d3fc9c1c4bd..772d3670c88 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeConfiguration.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeConfiguration.java @@ -71,6 +71,7 @@ public class PurgeConfiguration { } @VisibleForTesting + @CheckForNull Date maxLiveDateOfClosedIssues(Date now) { if (maxAgeInDaysOfClosedIssues > 0) { return DateUtils.addDays(now, -maxAgeInDaysOfClosedIssues); -- 2.39.5