diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-10 15:57:00 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-09-10 16:24:35 +0200 |
commit | d716cb1dbbe8a57e5c659c8be3dc0a4dd47d160a (patch) | |
tree | 1d98f216d13222e60ac3a5f7b62c1021d9d41d79 /sonar-batch | |
parent | d000d02bf54c1cdd44bfd8b8a5434df1bb4fb4c8 (diff) | |
download | sonarqube-d716cb1dbbe8a57e5c659c8be3dc0a4dd47d160a.tar.gz sonarqube-d716cb1dbbe8a57e5c659c8be3dc0a4dd47d160a.zip |
Do not return empty array of locations in WS
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java | 28 |
1 files changed, 15 insertions, 13 deletions
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()); } } |