Backelite / sonar-objective-c

Sonar Plugin for Objective-C
197 stars 75 forks source link

NullPointerException when processing JUnit report but test files not included in analysis #35

Open gretzki opened 7 years ago

gretzki commented 7 years ago

When analysing a project with a test report, SurefireParser will process the reports and calls context.saveMeasure on the unit test resources. But if the unit test resources are not published to sonar-scanner via sonar.tests (cmdline or sonar-project.properties file), the unit test resource can't be found and context.saveMeasure will be invoked with null as resource parameter. This will ultimately crash sonar-scanner.

This plugin should check if the unit test resource can be retrieved before calling context.saveMeasure to prevent the crash.

Tested on SonarQube 5.6.6 and sonar-objective-c plugin 0.6.1. But will most likely occur on SonarQube 6.x too.

zippy1978 commented 6 years ago

Hi @gretzki,

Since I upgraded SonarQube API, the way saveMeasure works is now different.

Could you tell me if the bug is gone with version 0.6.2 of the plugin ?

Gilles.