RohanA
(Rohan)
February 15, 2022, 3:57pm
#1
Running stand-alone sonar scanner to load results from json file in Generic Issue Import Format by running below command from project root :
sonar-scanner.bat -D"sonar.projectKey=XYZ" -D"sonar.sources=C:\xyz\abc\Code\XML\App" -D"sonar.host.url=http://192.xxx.xx.xxxx:9000" -D"sonar.login=981de4xxxcxxxcbc38162e3xxxx" -Dsonar.externalIssuesReportPaths=C:\xyz\abc\Code\Issues.json
getting below error message :
Rebse
(Gilbert Rebhan)
February 15, 2022, 5:06pm
#2
Hi,
in general it’s better to post the logs as txt and not as png.
Did the loglevel via -X reveal more insights ?
A shot in the blue after a quick look at the stacktrace:
try (Reader reader = Files.newBufferedReader(filePath, StandardCharsets.UTF_8)) {
return validate(gson.fromJson(reader, Report.class));
} catch (JsonIOException | IOException e) {
throw new IllegalStateException("Failed to read external issues report '" + filePath + "'", e);
} catch (JsonSyntaxException e) {
throw new IllegalStateException("Failed to read external issues report '" + filePath + "': invalid JSON syntax", e);
}
}
private Report validate(Report report) {
for (Issue issue : report.issues) {
mandatoryField(issue.primaryLocation, "primaryLocation");
mandatoryField(issue.engineId, "engineId");
mandatoryField(issue.ruleId, "ruleId");
mandatoryField(issue.severity, "severity");
mandatoryField(issue.type, "type");
mandatoryField(issue.primaryLocation, "primaryLocation");
mandatoryFieldPrimaryLocation(issue.primaryLocation.filePath, "filePath");
mandatoryFieldPrimaryLocation(issue.primaryLocation.message, "message");
if (issue.primaryLocation.textRange != null) {
Maybe the report file has no issues !?
Gilbert