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

Findbugs plugin 1.16 only shows one warning per class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: findbugs-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      I have the findbugs plugin version 1.16, and we have some classes with multiple
      problems reported by findbugs. However the findbugs plugin is only counting and
      showing the first problem in each class. If I open the same findbugs.xml report
      file in the findbugs GUI, then it shows all warnings for a class.

        Attachments

          Activity

          Hide
          brucechapman brucechapman added a comment -

          Created an attachment (id=114)
          findbugs.xml as displayed in findbugs GUI

          Show
          brucechapman brucechapman added a comment - Created an attachment (id=114) findbugs.xml as displayed in findbugs GUI
          Hide
          brucechapman brucechapman added a comment -

          Created an attachment (id=115)
          findbugs.xml as displayed by hudson

          Show
          brucechapman brucechapman added a comment - Created an attachment (id=115) findbugs.xml as displayed by hudson
          Hide
          brucechapman brucechapman added a comment -

          Looking at the two attached images, note that the findbugs GUI shows 40 warning
          across 16 files in the package displayed. The hudson display of the same package
          from the same findbugs.xml file shows only 16 warnings, one per class. It looks
          like (unconfirmed) it is displaying only the first (in line number order)
          warning for each class.

          Show
          brucechapman brucechapman added a comment - Looking at the two attached images, note that the findbugs GUI shows 40 warning across 16 files in the package displayed. The hudson display of the same package from the same findbugs.xml file shows only 16 warnings, one per class. It looks like (unconfirmed) it is displaying only the first (in line number order) warning for each class.
          Hide
          drulli Ulli Hafner added a comment -

          Could you please attach the findbugs.xml file with the warnings?

          BTW: Currently the Hudson findbugs-plugin is "optimized" for the
          maven-findbugs-plugin (rather than the ant task), which uses a different xml
          format. I currently use some shortcuts to create the warnings of the ant file,
          maybe this should be enhanced.

          Show
          drulli Ulli Hafner added a comment - Could you please attach the findbugs.xml file with the warnings? BTW: Currently the Hudson findbugs-plugin is "optimized" for the maven-findbugs-plugin (rather than the ant task), which uses a different xml format. I currently use some shortcuts to create the warnings of the ant file, maybe this should be enhanced.
          Hide
          msgray msgray added a comment -

          I also ran into this problem. I am using findbugs 1.2.1, with the findbugs.xml
          file generated by ant. I noticed when I saw the following console output from
          the hudson build:

          findbugs:
          [findbugs] Running FindBugs...
          [findbugs] Warnings generated: 70
          [findbugs] Output saved to ...

          BUILD SUCCESSFUL
          Total time: 43 seconds
          Recording test results
          Collecting findbugs analysis files...
          A total of 16 potential bugs have been found.
          finished: UNSTABLE

          It does have to do with the parsing as drulli suspects. I cannot attach my
          findbugs.xml file, but here is an example of the format of the relevant part of
          the generated XML:

          <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" abbrev="DLS"
          category="STYLE">
          <Class classname="com.myproj.MyClass">
          <SourceLine classname="com.myproj.MyClass" start="33" end="664"
          sourcefile="MyClass.java" sourcepath="com/myproj/MyClass.java"/>
          </Class>
          <Method classname="com.myproj.MyClass" name="myMethod" signature="()[B"
          isStatic="false">
          <SourceLine classname="com.com.myprojMyClass" start="433" end="502"
          startBytecode="0" endBytecode="160" sourcefile="MyClass.java"
          sourcepath="com/myproj/MyClass.java"/>
          </Method>
          <LocalVariable name="checksum" register="13" pc="184"
          role="LOCAL_VARIABLE_NAMED"/>
          <SourceLine classname="com.myproj.MyClass" start="472" end="472"
          startBytecode="182" endBytecode="182" sourcefile="MyClass.java"
          sourcepath="com/myproj/MyClass.java"/>
          </BugInstance>

          I made some changes to the FindBugsCounter.parse121Format() method locally. My
          changes seem to almost fix the problem:

          findbugs:
          [findbugs] Running FindBugs...
          [findbugs] Warnings generated: 70
          [findbugs] Output saved to ...

          BUILD SUCCESSFUL
          Total time: 2 minutes 20 seconds
          Collecting findbugs analysis files...
          A total of 69 potential bugs have been found.
          finished: SUCCESS

          So I still have one missing in my case. Not sure about the urgency, but if you
          are willing to wait a while I can check in my changes. (I may have one or two
          questions first though).

          In any case I hope this helps a little.

          Michael

          Show
          msgray msgray added a comment - I also ran into this problem. I am using findbugs 1.2.1, with the findbugs.xml file generated by ant. I noticed when I saw the following console output from the hudson build: findbugs: [findbugs] Running FindBugs... [findbugs] Warnings generated: 70 [findbugs] Output saved to ... BUILD SUCCESSFUL Total time: 43 seconds Recording test results Collecting findbugs analysis files... A total of 16 potential bugs have been found. finished: UNSTABLE It does have to do with the parsing as drulli suspects. I cannot attach my findbugs.xml file, but here is an example of the format of the relevant part of the generated XML: <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" abbrev="DLS" category="STYLE"> <Class classname="com.myproj.MyClass"> <SourceLine classname="com.myproj.MyClass" start="33" end="664" sourcefile="MyClass.java" sourcepath="com/myproj/MyClass.java"/> </Class> <Method classname="com.myproj.MyClass" name="myMethod" signature="()[B" isStatic="false"> <SourceLine classname="com.com.myprojMyClass" start="433" end="502" startBytecode="0" endBytecode="160" sourcefile="MyClass.java" sourcepath="com/myproj/MyClass.java"/> </Method> <LocalVariable name="checksum" register="13" pc="184" role="LOCAL_VARIABLE_NAMED"/> <SourceLine classname="com.myproj.MyClass" start="472" end="472" startBytecode="182" endBytecode="182" sourcefile="MyClass.java" sourcepath="com/myproj/MyClass.java"/> </BugInstance> I made some changes to the FindBugsCounter.parse121Format() method locally. My changes seem to almost fix the problem: findbugs: [findbugs] Running FindBugs... [findbugs] Warnings generated: 70 [findbugs] Output saved to ... BUILD SUCCESSFUL Total time: 2 minutes 20 seconds Collecting findbugs analysis files... A total of 69 potential bugs have been found. finished: SUCCESS So I still have one missing in my case. Not sure about the urgency, but if you are willing to wait a while I can check in my changes. (I may have one or two questions first though). In any case I hope this helps a little. Michael
          Hide
          drulli Ulli Hafner added a comment -

          Hi Michael,

          feel free to apply your patch! I hope that the code base has not been changed
          too much since you made the patch. (The parse121Format method has been renamed
          in findbugs release 1.12!)

          In the long term I hope to use the findbugs API to read those files...

          Show
          drulli Ulli Hafner added a comment - Hi Michael, feel free to apply your patch! I hope that the code base has not been changed too much since you made the patch. (The parse121Format method has been renamed in findbugs release 1.12!) In the long term I hope to use the findbugs API to read those files...
          Hide
          drulli Ulli Hafner added a comment -

          Fixed by Michael Gray in HEAD. Will be part of findbugs 1.18.

          Show
          drulli Ulli Hafner added a comment - Fixed by Michael Gray in HEAD. Will be part of findbugs 1.18.

            People

            Assignee:
            drulli Ulli Hafner
            Reporter:
            brucechapman brucechapman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: