aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin/src
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-06 11:25:14 +0000
committerGodin <mandrikov@gmail.com>2010-12-06 11:25:14 +0000
commit73c870d39a1d5a9af9fa7c4b75e3920d555a6400 (patch)
tree871540572da8899bcfccbe5b4f042b05664c55da /plugins/sonar-core-plugin/src
parent7f27dc28f2512e81a0fe7e39c89c1f1ad13bbe44 (diff)
downloadsonarqube-73c870d39a1d5a9af9fa7c4b75e3920d555a6400.tar.gz
sonarqube-73c870d39a1d5a9af9fa7c4b75e3920d555a6400.zip
SONAR-1450: Don't do anything in ViolationPersisterDecorator if no violations for current resource
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java5
1 files changed, 4 insertions, 1 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 1508abf0de8..5290bd6b02f 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
@@ -52,6 +52,9 @@ public class ViolationPersisterDecorator implements Decorator {
}
public void decorate(Resource resource, DecoratorContext context) {
+ if (context.getViolations().isEmpty()) {
+ return;
+ }
// Load past violations
List<RuleFailureModel> pastViolations = pastViolationsLoader.getPastViolations(resource);
// Load current source and calculate checksums
@@ -136,7 +139,7 @@ public class ViolationPersisterDecorator implements Decorator {
*/
private RuleFailureModel selectPastViolationUsingLine(Violation violation, Collection<RuleFailureModel> pastViolations) {
for (RuleFailureModel pastViolation : pastViolations) {
- if (ObjectUtils.equals(violation.getLineId(), pastViolation.getLine()) && StringUtils.equals(violation.getMessage(), pastViolation.getMessage())) {
+ if (ObjectUtils.equals(violation.getLineId(), pastViolation.getLine()) && StringUtils.equals(violation.getMessage(), pastViolation.getMessage())) {
return pastViolation;
}
}