aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-01-26 09:46:28 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-01-26 10:19:38 +0100
commitfa23d5c75f19292e488c6aed3da14794b193a5de (patch)
tree35da53955d6bd45b15b708fcbb405a0c55327973 /sonar-batch/src
parentaa5364a765fe4ef24ee1fb49c016fe70dafc3ef2 (diff)
downloadsonarqube-fa23d5c75f19292e488c6aed3da14794b193a5de.tar.gz
sonarqube-fa23d5c75f19292e488c6aed3da14794b193a5de.zip
SONAR-6012 Fix manual severity and get previous creation date
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java19
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java2
2 files changed, 6 insertions, 15 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
index 97c1b031b5a..773c128e403 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
@@ -138,11 +138,11 @@ public class LocalIssueTracking implements BatchComponent {
issue.setResolution(ref.resolution());
issue.setStatus(ref.status());
issue.setAssignee(ref.assigneeLogin());
+ issue.setCreationDate(ref.creationDate());
- String overriddenSeverity = ref.severity();
- if (overriddenSeverity != null) {
+ if (ref.isManualSeverity()) {
// Severity overriden by user
- issue.setSeverity(overriddenSeverity);
+ issue.setSeverity(ref.severity());
}
}
}
@@ -174,19 +174,10 @@ public class LocalIssueTracking implements BatchComponent {
issue.setResolution(previous.resolution());
issue.setMessage(previous.message());
issue.setLine(previous.line());
- String overriddenSeverity = previous.severity();
- if (overriddenSeverity != null) {
- issue.setSeverity(overriddenSeverity);
- } else {
- ActiveRule activeRule = activeRules.find(RuleKey.of(previous.ruleRepo(), previous.ruleKey()));
- if (activeRule != null) {
- // FIXME if rule was removed we can't guess what was the severity of the issue
- issue.setSeverity(activeRule.severity());
- }
- }
+ issue.setSeverity(previous.severity());
issue.setAssignee(previous.assigneeLogin());
issue.setComponentKey(previous.componentKey());
- issue.setManualSeverity(overriddenSeverity != null);
+ issue.setManualSeverity(previous.isManualSeverity());
issue.setRuleKey(RuleKey.of(previous.ruleRepo(), previous.ruleKey()));
issue.setNew(false);
return issue;
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
index 10726e7b33f..ad145b6c286 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/ReportsMediumTest.java
@@ -58,7 +58,7 @@ public class ReportsMediumTest {
.setComponentKey("sample:xources/hello/HelloJava.xoo")
.setRuleKey("xoo", "OneIssuePerLine")
.setLine(1)
- .setOverriddenSeverity("MAJOR")
+ .setSeverity("MAJOR")
.setChecksum(DigestUtils.md5Hex("dontexist"))
.setStatus("OPEN"))
.build();