summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java6
2 files changed, 5 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java
index f73c35c0679..63109a53d85 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorStorage.java
@@ -231,8 +231,6 @@ public class DefaultSensorStorage implements SensorStorage {
@Override
public BatchReport.SyntaxHighlighting apply(SyntaxHighlightingRule input) {
- builder.clear();
- rangeBuilder.clear();
builder.setRange(rangeBuilder.setStartLine(input.range().start().line())
.setStartOffset(input.range().start().lineOffset())
.setEndLine(input.range().end().line())
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
index 5190bb1a0f1..62f96db4ff9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultInputFile.java
@@ -227,6 +227,10 @@ public class DefaultInputFile implements InputFile {
public TextRange newRange(TextPointer start, TextPointer end) {
checkValid(start, "start pointer");
checkValid(end, "end pointer");
+ return newRangeValidPointers(start, end);
+ }
+
+ private TextRange newRangeValidPointers(TextPointer start, TextPointer end) {
Preconditions.checkArgument(start.compareTo(end) < 0, "Start pointer %s should be before end pointer %s", start, end);
return new DefaultTextRange(start, end);
}
@@ -235,7 +239,7 @@ public class DefaultInputFile implements InputFile {
* Create Range from global offsets. Used for backward compatibility with older API.
*/
public TextRange newRange(int startOffset, int endOffset) {
- return newRange(newPointer(startOffset), newPointer(endOffset));
+ return newRangeValidPointers(newPointer(startOffset), newPointer(endOffset));
}
public TextPointer newPointer(int globalOffset) {