summaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2014-02-13 11:46:11 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2014-02-13 11:46:11 +0100
commit3f99ae14192e0cddf06c87a913ccdf69b3c7ba58 (patch)
treefbf88bb02e8bafdebc3bc9ce2e8ac087f5973715 /sonar-batch
parent1b423fddea159655701ba669523464a9ef86f917 (diff)
downloadsonarqube-3f99ae14192e0cddf06c87a913ccdf69b3c7ba58.tar.gz
sonarqube-3f99ae14192e0cddf06c87a913ccdf69b3c7ba58.zip
Little improvements of technical debt
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
index 04bb3b2b502..d8d99891078 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
@@ -33,7 +33,6 @@ import org.sonar.core.issue.IssueUpdater;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-
import java.util.*;
import static com.google.common.collect.Lists.newArrayList;
@@ -101,24 +100,26 @@ public class IssueChangelogDebtCalculator implements BatchComponent {
return diffs;
}
+ @CheckForNull
private WorkDuration newValue(FieldDiffs fieldDiffs) {
for (Map.Entry<String, FieldDiffs.Diff> entry : fieldDiffs.diffs().entrySet()) {
if (entry.getKey().equals(IssueUpdater.TECHNICAL_DEBT)) {
Long newValue = entry.getValue().newValueLong();
- return newValue != null ? workDurationFactory.createFromWorkingLong(newValue) : workDurationFactory.createFromWorkingLong(0l);
+ return workDurationFactory.createFromWorkingLong(newValue);
}
}
- return workDurationFactory.createFromWorkingLong(0l);
+ return null;
}
+ @CheckForNull
private WorkDuration oldValue(FieldDiffs fieldDiffs) {
for (Map.Entry<String, FieldDiffs.Diff> entry : fieldDiffs.diffs().entrySet()) {
if (entry.getKey().equals(IssueUpdater.TECHNICAL_DEBT)) {
Long value = entry.getValue().oldValueLong();
- return value != null ? workDurationFactory.createFromWorkingLong(value) : workDurationFactory.createFromWorkingLong(0l);
+ return workDurationFactory.createFromWorkingLong(value);
}
}
- return workDurationFactory.createFromWorkingLong(0l);
+ return null;
}
private boolean isAfter(@Nullable Date currentDate, @Nullable Date pastDate) {