aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-07-23 18:00:32 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-07-23 18:17:22 +0200
commita787d107f965f3e65a97e345222271f47954fac3 (patch)
tree7fd1bd2697c888d248704080ecfc15cd5d0e9e95 /sonar-batch
parentca113ae7a42a66442502cea211343a6916bf1d66 (diff)
downloadsonarqube-a787d107f965f3e65a97e345222271f47954fac3.tar.gz
sonarqube-a787d107f965f3e65a97e345222271f47954fac3.zip
SONAR-5389 Reset measure and issue builders after creation of object to allow reuse
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
index bd38dee8fbc..2a811068e54 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
@@ -24,6 +24,7 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.Sensor;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.SensorDescriptor;
+import org.sonar.api.batch.sensor.issue.IssueBuilder;
import org.sonar.api.batch.sensor.measure.Measure;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.rule.RuleKey;
@@ -58,8 +59,9 @@ public class OneIssuePerLineSensor implements Sensor {
if (linesMeasure == null) {
LoggerFactory.getLogger(getClass()).warn("Missing measure " + CoreMetrics.LINES_KEY + " on " + file);
} else {
+ IssueBuilder issueBuilder = context.issueBuilder();
for (int line = 1; line <= (Integer) linesMeasure.value(); line++) {
- context.addIssue(context.issueBuilder()
+ context.addIssue(issueBuilder
.ruleKey(ruleKey)
.onFile(file)
.atLine(line)