aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/issue/TrackerRawInputFactory.java10
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java28
2 files changed, 21 insertions, 17 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/TrackerRawInputFactory.java b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/TrackerRawInputFactory.java
index f5b79cf4e93..5cce8011da4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/issue/TrackerRawInputFactory.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/issue/TrackerRawInputFactory.java
@@ -133,11 +133,13 @@ public class TrackerRawInputFactory {
dbLocationsBuilder.setTextRange(convertTextRange(reportIssue.getTextRange()));
}
for (BatchReport.Flow flow : reportIssue.getFlowList()) {
- DbIssues.Flow.Builder dbFlowBuilder = DbIssues.Flow.newBuilder();
- for (BatchReport.IssueLocation location : flow.getLocationList()) {
- dbFlowBuilder.addLocation(convertLocation(location));
+ if (flow.getLocationCount()>0) {
+ DbIssues.Flow.Builder dbFlowBuilder = DbIssues.Flow.newBuilder();
+ for (BatchReport.IssueLocation location : flow.getLocationList()) {
+ dbFlowBuilder.addLocation(convertLocation(location));
+ }
+ dbLocationsBuilder.addFlow(dbFlowBuilder);
}
- dbLocationsBuilder.addFlow(dbFlowBuilder);
}
issue.setLocations(dbLocationsBuilder.build());
return issue;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java
index 9db7fd69fde..f8ade4d0702 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java
@@ -109,21 +109,23 @@ public class ModuleIssues {
private void applyFlows(Issue issue) {
for (Flow flow : issue.flows()) {
- flowBuilder.clear();
- for (org.sonar.api.batch.sensor.issue.IssueLocation location : flow.locations()) {
- locationBuilder.clear();
- locationBuilder.setComponentRef(componentCache.get(location.inputComponent()).batchId());
- String message = location.message();
- if (message != null) {
- locationBuilder.setMsg(message);
+ if (!flow.locations().isEmpty()) {
+ flowBuilder.clear();
+ for (org.sonar.api.batch.sensor.issue.IssueLocation location : flow.locations()) {
+ locationBuilder.clear();
+ locationBuilder.setComponentRef(componentCache.get(location.inputComponent()).batchId());
+ String message = location.message();
+ if (message != null) {
+ locationBuilder.setMsg(message);
+ }
+ TextRange textRange = location.textRange();
+ if (textRange != null) {
+ locationBuilder.setTextRange(toProtobufTextRange(textRange));
+ }
+ flowBuilder.addLocation(locationBuilder.build());
}
- TextRange textRange = location.textRange();
- if (textRange != null) {
- locationBuilder.setTextRange(toProtobufTextRange(textRange));
- }
- flowBuilder.addLocation(locationBuilder.build());
+ builder.addFlow(flowBuilder.build());
}
- builder.addFlow(flowBuilder.build());
}
}