SonarQube PHP
  1. SonarQube PHP
  2. SONARPHP-68

Coverage analysis crashes when "statements" metric is zero.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 1.0
    • Component/s: None
    • Number of attachments :
      0

      Description

      On a rare occasion when coverage report contains line like this

      <metrics loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
      

      analysis crashes with the following error:

      Caused by: java.lang.NumberFormatException
      	at java.math.BigDecimal.<init>(BigDecimal.java:459)
      	at java.math.BigDecimal.<init>(BigDecimal.java:728)
      	at java.math.BigDecimal.valueOf(BigDecimal.java:1054)
      	at org.sonar.api.utils.ParsingUtils.scaleValue(ParsingUtils.java:70)
      	at org.sonar.api.utils.ParsingUtils.scaleValue(ParsingUtils.java:63)
      	at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.saveCoverageMeasure(PhpUnitCoverageResultParser.java:157)
      	at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.parseFileNodes(PhpUnitCoverageResultParser.java:123)
      	at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.parseFile(PhpUnitCoverageResultParser.java:107)
      	at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.parse(PhpUnitCoverageResultParser.java:91)
      	at org.sonar.plugins.php.phpunit.PhpUnitSensor.analyse(PhpUnitSensor.java:74)
      	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
      	at org.sonar.batch.phases.Phases.execute(Phases.java:93)
      	at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
      

      See the example with the full stacktrace here: https://gist.github.com/1433882

        Issue Links

          Activity

          Hide
          Fabrice Bellingard added a comment -

          Fixed by duplicate ticket SONARPLUGINS-1591

          Show
          Fabrice Bellingard added a comment - Fixed by duplicate ticket SONARPLUGINS-1591

            People

            • Assignee:
              Sebastian Marek
              Reporter:
              Anonymous
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: