FindBugs not showing the bugs found

30,708

Solution 1

If you have bugs showing up in some projects but not others, the problem may be that the bugs in one project are just not severe enough to show up.

I had the same issue (30 bugs showing up in Open Analysis Results in Editor) but none in Problems view or Find Bugs Explorer. The following worked for me:

1. Project -> Properties -> Find Bugs
2. Enable Project Specific Settings
3. Check everything under Report Visible Bug Categories
4. Slide minium rank to report to 20
5. Set minimum confidence to Low
6. Rerun FindBugs

Solution 2

This may be a problem of the configuration of your problems view. Do the following steps to ensure that the findbugs findings are shown in the problems view:

  1. Select the problems view (no findbugs warnings or errors shown)
  2. Select from the drop-down menu of the problems view (Caret down button) the menu entry "Configure Contents..."
  3. Select in the left side view e.g. "Errors/Warnings on Project"
  4. Ensure that on the right side, in the Types list, all the Findbugs Types are selected.
  5. Finish the configuration of the view.

Now the problems view should show you the 3 findings of before.

Alternatively, you could use the Findbugs perspective to get a deeper insight of the problems found.

I have found an additional entry at the Findbugs Eclipse Plugin Page: Eclipse Plugin loads, but does not work correctly. Check that as well.


When Findbugs tries to analyze your classes (not: the source code), the classes used by your code have to be available. I do not know for which bug patterns this is necessary, but for some (flow analysis), the used classes have to be reachable. So ensure that the used classes (directly or indirectly) are visible in the loadpath of eclipse.

Solution 3

I just stumpled upon a similar problem when using maven, eclipse and m2e-code-quality plugin (https://github.com/m2e-code-quality/m2e-code-quality). Solution was to list all visitors which should be run in a visitors tag in the configuration of the findbugs-maven-plugin. Also you may want to set maxRank to 20. When you omit the visitors to run the m2e-code-quality plugin will generate a findbugs plugin config which runs NO visitor at all. Worst part is that the findbug settings in the project properties will show some enabled visitors but these don't come from the project config.

Share:
30,708
stivlo
Author by

stivlo

I'm a software developer, living in London. I'm interested in programming and system administration, in particular in the following areas: Java, JSP, JSTL, Ant, Maven TDD, JUnit, Mockito, Hibernate, JPA Spring Framework, Apache Lucene, iText PDF Amazon AWS: EC2, SimpleDB, SES, S3 Javascript, ExtJS, jQuery, Perl, PHP Linux, Postfix, Apache, Tomcat Currently learning Natural Language Processing with Gate My blog about programming & sysadm & travel: http://www.stefanolocati.it/ My github repos: https://github.com/stivlo Why I like stackoverflow: when I was in the University's Unix lab, I could ask questions to the gurus passing their days there and have wonderful inputs to solve practical problems and to improve my skills; being in stackoverflow, is a bit like hanging in the lab again. No, wait, actually it's much better, because of the wide skillset and quantity of geeks.

Updated on October 08, 2020

Comments

  • stivlo
    stivlo over 3 years

    I've used FindBugs before and I didn't have problems, however this time on Eclipse Helios on Ubuntu Natty Narval bugs are found but not shown.

    Here's what I tried:

    • Right Click on the project > Find Bugs > Find Bugs
    • Looking at the progress I saw 3 bugs were found
    • In the Problems view they are not listed

    I tried to go to its own perspective with: Open Perspective > Other > FindBugs but Bug Explorer is empty.

    Any ideas to view those bugs?

    UPDATE: In Eclipse error log I see:

    !ENTRY edu.umd.cs.findbugs.plugin.eclipse 2 2 2011-06-18 21:13:24.968
    !MESSAGE The following classes needed for FindBugs analysis on project **
         were missing:
    !SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
    !MESSAGE org.apache.commons.exec.CommandLine
    !SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
    !MESSAGE org.apache.commons.exec.DefaultExecutor
    !SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
    !MESSAGE org.apache.commons.exec.ExecuteException
    

    UPDATE 2: I don't know how to fix Eclipse, but I found a workaround. I added the findbugs report to maven's pom.xml

    <reporting>
        <plugins>
            [...]
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>2.3.3-SNAPSHOT</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                    <!-- Optional derectory to put findbugs xdoc xml report -->
                    <xmlOutputDirectory>target/site</xmlOutputDirectory>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    

    The following configuration generates an HTML report in target/site/findbugs.html

  • stivlo
    stivlo almost 13 years
    Thank you, what you say makes sense, however, even going to configure contents, checking Errors/Warnings on Project (show results matching: any enabled filter), Severity: Error, Warning, Info all checked, Types all checked including FindBugs, OK, run FindBugs again, nothing shown. FindBugs perspective, nothing shown too. :-(
  • mliebelt
    mliebelt almost 13 years
    Well, I cannot reproduce it here. When I change to the findbugs perspective, I see the last project that was checked by findbugs (left view named "Bug Explorer". Do you see there the project you have checked? And even if I set there filters, I see e.g. "Unused field (0/41 filtered)". So Findbugs should show something to you if it has checked your project. Had you had a look at your logfile, or looked at the error log?
  • stivlo
    stivlo almost 13 years
    It's empty, but I discovered that running FindBugs on another project it showed me three bugs, and I could see them as a warning in the Problems view and also in FindBugs perspective. I introduced a bug ["".trim();] in the previous project and was caught and shown. In both projects some bugs are caught, but not shown. I didn't look the logfile or error.log for eclipse, I try to find them now.
  • Melloware
    Melloware over 12 years
    I have this exact same problem and I tried the above steps but Bug Explorer is still showing nothing
  • Helden
    Helden over 12 years
    Anyone got a solution on this issue?
  • mliebelt
    mliebelt over 12 years
    Could you add the information about the version you are using? JDK, Eclipse, Findbugs Plugin, ...?
  • letmaik
    letmaik almost 12 years
    Got the same problem... Eclipse Indigo, JDK 7, FindBugs 2.0.1.20120419