Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67114

IndexOutOfBoundsException when clicking a per-tool report that did not have any warnings

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • warnings-ng-plugin
    • None
    • Jenkins 2.303.3
      Warnings Next Generation Plugin 9.7.0
      Analysis Model API Plugin 10.6.0

    Description

      I had configured aggregated reporting in Warnings Next Generation, like this:

      recordIssues(
          tools: [
              docFx(pattern: 'obj/docfx.log.json', reportEncoding: 'UTF-8'),
              msBuild(pattern: 'MSBuild.log', reportEncoding: 'UTF-8')],
          qualityGates: [
              [threshold: 1, type: 'TOTAL_NORMAL', unstable: true],
              [threshold: 1, type: 'TOTAL_HIGH', unstable: false],
              [threshold: 1, type: 'TOTAL_ERROR', unstable: false]],
          sourceCodeEncoding: 'UTF-8',
          publishAllIssues: true,
          aggregatingResults: true)
      

      The build wrote some warnings to obj/docfx.log.json but none to MSBuild.log.
      After the build, Jenkins displayed:

      Static Analysis: 9 warnings (from 2 analyses)

      • Static analysis results from: MSBuild, DocFX
      • New issues: 9
      • Reference build: PR-70 #31
      • Quality gate: Unstable

      I clicked the "DocFX" link and Jenkins correctly displayed the warnings reported by DocFX.
      I then returned to the previous page and clicked the "MSBuild" link. That caused an error:

      Oops!
      A problem occurred while processing the request.

      Logging ID=202cc84a-ee54-4e33-9132-1ced637bf249

      The Jenkins log contains:

      marraskuuta 11, 2021 1:49:17 IP. WARNING hudson.init.impl.InstallUncaughtExceptionHandler handleException
      
      Caught unhandled exception with ID 202cc84a-ee54-4e33-9132-1ced637bf249
      java.lang.IndexOutOfBoundsException: No such index 0 in - (-): 0 issues (0 duplicates)
      	at edu.hm.hafner.analysis.Report.get(Report.java:517)
      	at io.jenkins.plugins.analysis.core.model.DetailFactory.getPropertyValueAsString(DetailFactory.java:201)
      	at io.jenkins.plugins.analysis.core.model.DetailFactory.getDisplayNameOfDetails(DetailFactory.java:184)
      	at io.jenkins.plugins.analysis.core.model.DetailFactory.createFilteredView(DetailFactory.java:133)
      	at io.jenkins.plugins.analysis.core.model.DetailFactory.createTrendDetails(DetailFactory.java:89)
      	at io.jenkins.plugins.analysis.core.model.IssuesDetail.getDynamic(IssuesDetail.java:615)
      	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:393)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)
      	at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:455)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
      Caused: javax.servlet.ServletException
      	[REDACTED the rest]
      

      This could possibly be fixed by omitting the link to the per-tool report if there were no issues from that tool. However, it would be better to keep the link and fix the report, because the per-tool trend graph may still be interesting to users.

      Attachments

        Issue Links

          Activity

            Actually, I get the same error when I click the per-tool report link after a build in which neither tool reported any warnings.

            kon Kalle Niemitalo added a comment - Actually, I get the same error when I click the per-tool report link after a build in which neither tool reported any warnings.
            drulli Ulli Hafner added a comment -

            I removed the links if the warnings are zero now. This is more consistent with the overall behavior when there are no issues in the project. I think a detail view that shows zero warnings does not help much. (The trend chart is always the trend of all tools and visible in the other detail views as well).

            drulli Ulli Hafner added a comment - I removed the links if the warnings are zero now. This is more consistent with the overall behavior when there are no issues in the project. I think a detail view that shows zero warnings does not help much. (The trend chart is always the trend of all tools and visible in the other detail views as well).

            People

              drulli Ulli Hafner
              kon Kalle Niemitalo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: