SonarQube Plugins
  1. SonarQube Plugins
  2. SONARPLUGINS-1603

Null pointer exception when CiManagement was null and project does not have a POM

    Details

    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      If project.getConfiguration().getString(CI_URL_PROPERTY) does not return a URL (CiManagement property is blank, as is the case of a new project in Sonar) and the project.getPom() is null, a NPE is thrown by the project.getPom().getCiManagement() call.

      I am attaching a patch that I have used to fix the issue for my system.

      Reproduction:
      Install the Build Stability plugin in Sonar and Hudson
      Configure the Hudson plugin
      Configure the Sonar plugin
      Create a new job in Hudson (Not Maven, no POM) and use the 'Invoke Standalone Sonar Analysis' to publish the results to Sonar
      Execute the job on Hudson and you should get an NPE from the Build Stability Sonar plugin

        Issue Links

          Activity

          Hide
          John Tangney added a comment -

          If my Jenkins job specifies this property:
          sonar.build-stability.url=Hudson:http://example.com/job/MyJob/
          then everything works.

          However, many jobs have not been configured to use the build stability plugin, so they just fail because of this issue. Here's another suggested workaround: Change the plugin so that it does not work unless explicitly enabled. That way projects that do not know or care about this plugin can still function.

          Show
          John Tangney added a comment - If my Jenkins job specifies this property: sonar.build-stability.url=Hudson: http://example.com/job/MyJob/ then everything works. However, many jobs have not been configured to use the build stability plugin, so they just fail because of this issue. Here's another suggested workaround: Change the plugin so that it does not work unless explicitly enabled. That way projects that do not know or care about this plugin can still function.
          Hide
          Fabrice Bellingard added a comment -

          Tested!

          Show
          Fabrice Bellingard added a comment - Tested!

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Curtis Boyden
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: