How to deserialize the issue.pb in scanner-report?

AFAIK, The last step of sonar-scanner is uploading the overall report to the central server, beacuse of the speed’s need, we want to remove the step. Up to now, we export the result from the server, i.e. uploadToSonarServer -> exportFromSonarServer. Now we just want to uploadToOurServer directly. I try to parse the issues-.pb by myself from sonar-report report directory, but it doesn’t work. I think I found the wrong .proto file : ws-issues.proto, could you help me out of this. How could I parse the issue detail from the issue-.pb by myself?

I think I found the key position, the scanner-report’s corresponding pb file is here: sonar_report_issue
But when I use this proto to generate the library code and using the generated library code to parse the issues-*.pb report file, it yields some errors:

    Traceback (most recent call last):
  File ".\", line 20, in <module>
  File "D:\Python27\lib\site-packages\google\protobuf\", line 199, in ParseFromString
    return self.MergeFromString(serialized)
  File "D:\Python27\lib\site-packages\google\protobuf\internal\", line 1145, in MergeFromString
    if self._InternalParse(serialized, 0, length) != length:
  File "D:\Python27\lib\site-packages\google\protobuf\internal\", line 1195, in InternalParse
    raise message_mod.DecodeError('Field number 0 is illegal.')
google.protobuf.message.DecodeError: Field number 0 is illegal.

hmmmm, Could you help me work it out now~?

Aha… I found the solution by calling ScannerReportReader. Thanks:-#

1 Like

@Dreaminplus I’m running into very same issue. can you please share the code you used to parse SQ report?
Thanks in advance

import org.sonar.core.util.CloseableIterator;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReportReader;

    ScannerReportReader reader = new ScannerReportReader(outputDir);
    ScannerReport.Component component = reader.readComponent(9);    // 9 <- issues-9.pb
    File fileSource = reader.readFileSource(9);
    String projectRelativePath = component.getProjectRelativePath();
    CloseableIterator<ScannerReport.Issue> reportIssues = reader.readComponentIssues(9);
    while (reportIssues.hasNext()) {
        ScannerReport.Issue reportIssue =;