aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java4
-rw-r--r--sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java2
-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
4 files changed, 9 insertions, 18 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java
index 8239717deb0..f519286ff4a 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java
@@ -33,7 +33,7 @@ public class PreviousIssue implements Serializable {
private Integer line;
private String message;
private String severity;
- private Boolean manualSeverity;
+ private boolean manualSeverity;
private String resolution;
private String status;
private String checksum;
@@ -144,7 +144,7 @@ public class PreviousIssue implements Serializable {
return ruleKey;
}
- public Date getCreationDate() {
+ public Date creationDate() {
return creationDate;
}
diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java
index 750b35f8280..ffbc9545d85 100644
--- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java
+++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java
@@ -61,7 +61,7 @@ public class PreviousIssueHelperTest {
"[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", " +
"\"severity\": \"severity\", \"manualSeverity\": true, \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\"},"
+
- "{\"key\": \"key2\"}]",
+ "{\"key\": \"key2\", \"manualSeverity\": false}]",
out.getBuffer().toString(), true);
}
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();