Uploaded image for project: 'SonarPHP'
  1. SonarPHP
  2. SONARPHP-68

Coverage analysis crashes when "statements" metric is zero.

    XMLWordPrintable

    Details

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

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: