From 161500d45b63110519c7f9830eca58c9f84b7233 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 1 Mar 2016 17:47:16 +0100 Subject: [PATCH] SONAR-7330 Fix indexation of debt model reset --- .../main/java/org/sonar/server/debt/DebtModelBackup.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java index 997fb701a8f..ad69b0639a4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java @@ -108,7 +108,7 @@ public class DebtModelBackup { public void reset() { checkPermission(); - Date updateDate = new Date(system2.now()); + long updateDate = system2.now(); DbSession session = dbClient.openSession(false); try { // Restore rules @@ -125,14 +125,14 @@ public class DebtModelBackup { resetRules(ruleDtos, rules, updateDate, session); } - ruleIndexer.index(); session.commit(); + ruleIndexer.index(); } finally { MyBatis.closeQuietly(session); } } - private void resetRules(List ruleDtos, List rules, Date updateDate, DbSession session) { + private void resetRules(List ruleDtos, List rules, long updateDate, DbSession session) { for (RuleDto rule : ruleDtos) { // Restore default debt definitions @@ -158,7 +158,7 @@ public class DebtModelBackup { rule.setRemediationFunction(null); rule.setRemediationCoefficient(null); rule.setRemediationOffset(null); - rule.setUpdatedAt(updateDate.getTime()); + rule.setUpdatedAt(updateDate); dbClient.ruleDao().update(session, rule); } } -- 2.39.5