diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-04-03 14:29:04 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-04-07 17:21:33 +0200 |
commit | 0fa306da07d0b600f98830672e5ad3730735c2c5 (patch) | |
tree | c7e048414cb165c111b16576adef48f5c058f2c8 /sonar-batch | |
parent | 9f602a66d461ceb3c2cde7c44a6b7fb6c9db0a78 (diff) | |
download | sonarqube-0fa306da07d0b600f98830672e5ad3730735c2c5.tar.gz sonarqube-0fa306da07d0b600f98830672e5ad3730735c2c5.zip |
SONAR-6277 Fix id of component when publishing source code in report
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/report/SourcePublisher.java | 2 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/report/SourcePublisherTest.java | 8 |
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"); } } |