]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1450: Don't do anything in ViolationPersisterDecorator if no violations for...
authorGodin <mandrikov@gmail.com>
Mon, 6 Dec 2010 11:25:14 +0000 (11:25 +0000)
committerGodin <mandrikov@gmail.com>
Mon, 6 Dec 2010 11:25:14 +0000 (11:25 +0000)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java

index 1508abf0de848f869e4cfa239b11e1a792652b9f..5290bd6b02f2af15d0f2c1552501edd6e05d786a 100644 (file)
@@ -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;
       }
     }