aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol/src/main
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-07-29 01:45:49 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-07-31 11:00:25 +0200
commit5b93180b18e756c6a246b8d22307785d333d0002 (patch)
treef80ee109a5307bd3f9f221228f6ae25e5d3b161b /sonar-batch-protocol/src/main
parent1c2ee1119325e56aff63571094c3ad897d408c8c (diff)
downloadsonarqube-5b93180b18e756c6a246b8d22307785d333d0002.tar.gz
sonarqube-5b93180b18e756c6a246b8d22307785d333d0002.zip
Write raw issues directly in protobuf report
Avoid intermediate storage in persistit
Diffstat (limited to 'sonar-batch-protocol/src/main')
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
index bf0cdfcd736..8c68fa7fce5 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
@@ -19,7 +19,11 @@
*/
package org.sonar.batch.protocol.output;
+import java.io.BufferedOutputStream;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import org.sonar.core.util.ContextException;
import org.sonar.core.util.Protobuf;
public class BatchReportWriter {
@@ -67,6 +71,15 @@ public class BatchReportWriter {
return file;
}
+ public void appendComponentIssue(int componentRef, BatchReport.Issue issue) {
+ File file = fileStructure.fileFor(FileStructure.Domain.ISSUES, componentRef);
+ try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file, true))) {
+ issue.writeDelimitedTo(out);
+ } catch (Exception e) {
+ throw ContextException.of("Unable to write issue", e).addContext("file", file);
+ }
+ }
+
public File writeComponentMeasures(int componentRef, Iterable<BatchReport.Measure> measures) {
File file = fileStructure.fileFor(FileStructure.Domain.MEASURES, componentRef);
Protobuf.writeStream(measures, file, false);