diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-05 15:08:04 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-05-05 15:08:04 +0200 |
commit | bcc445118956633eb4084581a47edbe5672cefb4 (patch) | |
tree | bb9a602d2fe81041dd27ac00766b3895ce2f993e /plugins/sonar-core-plugin/src | |
parent | ae508ce93d67bb07ee70c2ec5290d6d093e12de4 (diff) | |
download | sonarqube-bcc445118956633eb4084581a47edbe5672cefb4.tar.gz sonarqube-bcc445118956633eb4084581a47edbe5672cefb4.zip |
Reduce technical debt
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/ViolationPersisterDecorator.java | 9 |
1 files changed, 7 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 ece114c8144..4935390e21d 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 @@ -23,7 +23,9 @@ import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; import org.sonar.api.batch.*; import org.sonar.api.database.model.RuleFailureModel; import org.sonar.api.database.model.SnapshotSource; @@ -123,7 +125,7 @@ public class ViolationPersisterDecorator implements Decorator { return violationMap; } - private final boolean isNotAlreadyMapped(Violation newViolation, Map<Violation, RuleFailureModel> violationMap) { + private boolean isNotAlreadyMapped(Violation newViolation, Map<Violation, RuleFailureModel> violationMap) { return violationMap.get(newViolation) == null; } @@ -161,7 +163,10 @@ public class ViolationPersisterDecorator implements Decorator { } private boolean isSameLine(Violation newViolation, RuleFailureModel pastViolation) { - return pastViolation.getLine() == newViolation.getLineId(); //When lines are null, we also return true + if (pastViolation.getLine()==null && newViolation.getLineId()==null) { + return true; + } + return ObjectUtils.equals(pastViolation.getLine(), newViolation.getLineId()); } private boolean isSameMessage(Violation newViolation, RuleFailureModel pastViolation) { |