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

FindBugs Plugin not reporting priorities correctly

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: findbugs-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      Hudson 1.383, FindBugs Plugin 4.14
      Maven multi-module build

      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
      <effort>Default</effort>
      <threshold>Default</threshold>
      <failOnError>true</failOnError>
      <includeTests>false</includeTests>
      <findbugsXmlOutput>true</findbugsXmlOutput>
      <xmlOutput>true</xmlOutput>
      </configuration>
      <executions>
      <execution>
      <id>findbugs-check</id>
      <goals>
      <goal>check</goal>
      </goals>
      </execution>
      </executions>
      </plugin>

      We're incorrectly seeing low priority warnings in Hudson when the above configuration should not be generating any. Looking at both findbugs.xml and findbugsXml.xml confirms that only normal and high priority issues are included in the findbugs output files.

      Here's what we're seeing in Hudson. Apologies for the formatting, I'll also attach a screenshot. Each group is a row in the "Warnings" tab of the Details section, each line is a cell. One interesting observation is that there are two Maven modules here; the first is reporting correctly, the second is reporting everything as Low priority.

      File   
      Module   
      Package   
      Line   
      Priority   
      Type   
      Category   

      PricingProgramResource.java
      tendril-platform-api-jaxrs
      com.tendril.platform.api.rest
      85
      High
      RC_REF_COMPARISON
      CORRECTNESS

      BillTestObjectFactory.java
      tendril-platform-api-schema
      com.tendril.platform.api
      63
      Low
      DLS_DEAD_LOCAL_STORE
      STYLE

      BillTestObjectFactory.java
      tendril-platform-api-schema
      com.tendril.platform.api
      77
      Low
      DLS_DEAD_LOCAL_STORE
      STYLE

      MeterReadingsMapper.java
      tendril-platform-api-schema
      com.tendril.platform.api.rest.mapper
      118
      Low
      DM_NUMBER_CTOR
      PERFORMANCE

      findbugs.xml:

      <BugInstance type="RC_REF_COMPARISON" priority="High" category="CORRECTNESS" message="Suspicious comparison of Integer references in com.tendril.platform.api.rest.PricingProgramResource.updatePricingProgram(Integer, PricingProgram)" lineNumber="85"/>

      <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="High" category="STYLE" message="Dead store to bucket2 in com.tendril.platform.api.BillTestObjectFactory.createBillConsumptionBuckets()" lineNumber="63"/>

      <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="High" category="STYLE" message="Dead store to bucket2 in com.tendril.platform.api.BillTestObjectFactory.createBillCostBuckets()" lineNumber="77"/>

      <BugInstance type="DM_NUMBER_CTOR" priority="Normal" category="PERFORMANCE" message="Method com.tendril.platform.api.rest.mapper.MeterReadingsMapper.createMeterReadings(AccountConsumptionList) invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead" lineNumber="118"/>

      findbugsXml.xml:

      <BugInstance category="CORRECTNESS" instanceHash="5c20efde23ef9b6b7cc91852b8a46503" instanceOccurrenceNum="0" priority="1" abbrev="RC" type="RC_REF_COMPARISON" instanceOccurrenceMax="0">

      <BugInstance category="STYLE" instanceHash="cb3819105f76e57c21b8a03b0704b0e4" instanceOccurrenceNum="0" priority="1" abbrev="DLS" type="DLS_DEAD_LOCAL_STORE" instanceOccurrenceMax="0">

      <BugInstance category="STYLE" instanceHash="a8145984419dc19ca65b3288186f7533" instanceOccurrenceNum="0" priority="1" abbrev="DLS" type="DLS_DEAD_LOCAL_STORE" instanceOccurrenceMax="0">

      <BugInstance category="PERFORMANCE" instanceHash="3a9337b4f7249f324284f8bd12393b1c" instanceOccurrenceNum="0" priority="2" abbrev="Bx" type="DM_NUMBER_CTOR" instanceOccurrenceMax="0">

        Attachments

          Activity

          Hide
          tpesce Tim Pesce added a comment -

          Screenshot of Hudson's FindBugs Warnings page.

          Show
          tpesce Tim Pesce added a comment - Screenshot of Hudson's FindBugs Warnings page.
          Hide
          drulli Ulli Hafner added a comment -

          I hope that I don't misunderstand that issue: recently, the 'priority' status of the findbugs warnings has been replaced by the 'rank' status. So some warnings with status low will now e.g. have a status 'normal' since the rank is different. (See Changelog).

          Show
          drulli Ulli Hafner added a comment - I hope that I don't misunderstand that issue: recently, the 'priority' status of the findbugs warnings has been replaced by the 'rank' status. So some warnings with status low will now e.g. have a status 'normal' since the rank is different. (See Changelog).
          Hide
          shannon shannon added a comment -

          I don't understand "the 'priority' status of the findbugs warnings has been
          replaced by the 'rank' status". Replaced by who? Where? Why?

          In the findbugsXml.xml file, the <BugInstance> entries have an attribute for
          priority. That's what I expect the graph to show.

          What is "rank" and where do you derive it from?

          Show
          shannon shannon added a comment - I don't understand "the 'priority' status of the findbugs warnings has been replaced by the 'rank' status". Replaced by who? Where? Why? In the findbugsXml.xml file, the <BugInstance> entries have an attribute for priority. That's what I expect the graph to show. What is "rank" and where do you derive it from?
          Hide
          drulli Ulli Hafner added a comment -

          The Findbugs team changed that in findbugs core and in the Hudson plug-in (see Changelog). The rank is a kind of priority and is a value between 0 and 20, this value is more precise then the old priority. See http://findbugs.sourceforge.net/api/edu/umd/cs/findbugs/BugRanker.html. In the Hudson plug-in it is mapped to priority LOW, NORMAL and HIGH (as this has been done by the priority in the older releases of the plug-in).

          The rank is derived from the warning ID, I'm not sure if is serialized in the findbugs.xml file yet.

          Show
          drulli Ulli Hafner added a comment - The Findbugs team changed that in findbugs core and in the Hudson plug-in (see Changelog). The rank is a kind of priority and is a value between 0 and 20, this value is more precise then the old priority. See http://findbugs.sourceforge.net/api/edu/umd/cs/findbugs/BugRanker.html . In the Hudson plug-in it is mapped to priority LOW, NORMAL and HIGH (as this has been done by the priority in the older releases of the plug-in). The rank is derived from the warning ID, I'm not sure if is serialized in the findbugs.xml file yet.
          Hide
          drulli Ulli Hafner added a comment -

          Reopened since I added a property to toggle the behavior in JENKINS-8558.

          Show
          drulli Ulli Hafner added a comment - Reopened since I added a property to toggle the behavior in JENKINS-8558 .
          Hide
          drulli Ulli Hafner added a comment -

          Will be part of 4.24.

          Show
          drulli Ulli Hafner added a comment - Will be part of 4.24.

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              tpesce Tim Pesce
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: