xUnit fails with NumberFormatException if threshold fields filled out in a certain way

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • Component/s: xunit-plugin
    • None

      xUnit crashes with the following exception:

      [xUnit] [INFO] - Starting to record.
      [xUnit] [INFO] - Processing CppUnit-1.12.1 (default)
      [xUnit] [INFO] - [CppUnit-1.12.1 (default)] - 1 test report file(s) were found with the pattern '**/src/associates/bnS3/Debug/result.xml' relative to 'C:\Jenkins\jobs\S3 Test\workspace' for the testing framework 'CppUnit-1.12.1 (default)'.
      [xUnit] [INFO] - Check 'Failed Tests' threshold.
      ERROR: Publisher org.jenkinsci.plugins.xunit.XUnitPublisher aborted due to exception
      java.lang.NumberFormatException: For input string: ""
      at java.lang.NumberFormatException.forInputString(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at org.jenkinsci.plugins.xunit.threshold.XUnitThreshold.convertToInteger(XUnitThreshold.java:134)
      at org.jenkinsci.plugins.xunit.threshold.XUnitThreshold.getResultThresholdNumber(XUnitThreshold.java:80)
      at org.jenkinsci.plugins.xunit.threshold.FailedThreshold.getResultThresholdNumber(FailedThreshold.java:34)
      at org.jenkinsci.plugins.xunit.XUnitPublisher.processResultThreshold(XUnitPublisher.java:354)
      at org.jenkinsci.plugins.xunit.XUnitPublisher.getResultWithThreshold(XUnitPublisher.java:338)
      at org.jenkinsci.plugins.xunit.XUnitPublisher.getBuildStatus(XUnitPublisher.java:321)
      at org.jenkinsci.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:124)
      at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:92)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:625)
      at hudson.model.Run.run(Run.java:1435)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)
      Finished: FAILURE

      On line 80 of XUnitThreshold.java the code checks getUnstableNewThreshold() for validity, but then attempts to convert getFailureNewThreshold(), so if the unstable new field was filled in but failure new field was not, it will cause an exception.

            Assignee:
            Gregory Boissinot
            Reporter:
            Iain macLeish
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: