aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-14 16:41:49 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-14 16:42:49 +0100
commitf543653d4fc293d7d3f0a025665ac0a5c275c6b4 (patch)
tree3f99de91cfd83ef1fd28b5bd8046ab30ed345c68 /plugins
parent62ca0c46b1a4e5a17e3a6d19d1b461d8a2ddd1f2 (diff)
downloadsonarqube-f543653d4fc293d7d3f0a025665ac0a5c275c6b4.tar.gz
sonarqube-f543653d4fc293d7d3f0a025665ac0a5c275c6b4.zip
SONAR-2251 Unstable state of violations when stopping a build
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
index e1299a01365..57460299a54 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java
@@ -93,11 +93,14 @@ public class ViolationPersisterDecorator implements Decorator {
for (Violation violation : context.getViolations()) {
RuleFailureModel pastViolation = selectPastViolation(violation, pastViolationsByRule);
if (pastViolation != null) {
- // remove violation from past, since would be updated and shouldn't affect other violations anymore
+ // remove violation, since would be updated and shouldn't affect other violations anymore
pastViolationsByRule.remove(violation.getRule(), pastViolation);
+ violation.setCreatedAt(pastViolation.getCreatedAt());
+ } else {
+ violation.setCreatedAt(null);//avoid plugins to set date
}
String checksum = getChecksumForLine(checksums, violation.getLineId());
- violationPersister.saveOrUpdateViolation(context.getProject(), violation, pastViolation, checksum);
+ violationPersister.saveViolation(context.getProject(), violation, checksum);
}
}