aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java8
2 files changed, 5 insertions, 5 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java
index ccb91681e2b..8f6b7f3ffb5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java
@@ -46,7 +46,7 @@ public class SourcePublisher implements ReportPublisherStep {
}
DefaultInputFile inputFile = (DefaultInputFile) resource.inputPath();
- File iofile = writer.getSourceFile(1);
+ File iofile = writer.getSourceFile(resource.batchId());
int line = 0;
try (FileOutputStream output = new FileOutputStream(iofile); BOMInputStream bomIn = new BOMInputStream(new FileInputStream(inputFile.file()),
ByteOrderMark.UTF_8, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java
index 824a6da2db9..e9b379a58e2 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java
@@ -68,7 +68,7 @@ public class SourcePublisherTest {
publisher.publish(writer);
- File out = writer.getSourceFile(1);
+ File out = writer.getSourceFile(2);
assertThat(FileUtils.readFileToString(out, Charsets.UTF_8)).isEqualTo("");
}
@@ -78,7 +78,7 @@ public class SourcePublisherTest {
publisher.publish(writer);
- File out = writer.getSourceFile(1);
+ File out = writer.getSourceFile(2);
assertThat(FileUtils.readFileToString(out, Charsets.UTF_8)).isEqualTo("1\n2\n3\n4\n");
}
@@ -88,7 +88,7 @@ public class SourcePublisherTest {
publisher.publish(writer);
- File out = writer.getSourceFile(1);
+ File out = writer.getSourceFile(2);
assertThat(FileUtils.readFileToString(out, Charsets.UTF_8)).isEqualTo("1\n2\n3\n4\n5");
}
@@ -98,7 +98,7 @@ public class SourcePublisherTest {
publisher.publish(writer);
- File out = writer.getSourceFile(1);
+ File out = writer.getSourceFile(2);
assertThat(FileUtils.readFileToString(out, Charsets.UTF_8)).isEqualTo("\n2\n3\n4\n5");
}
}