blob: 6e20e85d4c0057d9196f6ff6e9f6980b19a38c6a [file] [log] [blame]
<html>
<head>
<title>FindBugs FAQ</title>
<link rel="stylesheet" type="text/css" href="findbugs.css">
</head>
<body>
<table width="100%"><tr>
<td bgcolor="#b9b9fe" valign="top" align="left" width="20%">
<table width="100%" cellspacing="0" border="0">
<tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="FindBugs"></a></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><b>Docs and Info</b></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="demo.html">Demo and data</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="users.html">Users and supporters</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="manual/index.html">Manual</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="ja/manual/index.html">Manual(ja/&#26085;&#26412;&#35486;)</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="links.html">Links</a></font></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><a class="sidebar" href="downloads.html"><b>Downloads</b></a></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><a class="sidebar" href="http://www.cafeshops.com/findbugs"><b>FindBugs Swag</b></a></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><b>Development</b></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/tracker/?group_id=96405">Open bugs</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="contributing.html">Contributing</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="team.html">Dev team</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="api/index.html">API</a> <a class="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="Changes.html">Change log</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="http://sourceforge.net/projects/findbugs">SF project page</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbugs/source/browse/">Browse source</a></font></td></tr>
<tr><td><font size="-1"><a class="sidebar" href="http://code.google.com/p/findbugs/source/list">Latest code changes</a></font></td></tr>
</table>
</td>
<td>
<h1>FindBugs FAQ</h1>
<p> This document contains answers to frequently asked questions about
<a href="index.html">FindBugs</a>.&nbsp; If you just want general
information about FindBugs, have a look at the
<a href="factSheet.html">fact sheet</a> and the
<a href="manual/index.html">manual</a>.
<h2>Contents</h2>
<ol>
<li> <a href="#q1">I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a>
<li> <a href="#q2">When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a>
<li> <a href="#q3">FindBugs is running out of memory, or is taking a long time to finish</a>
<li> <a href="#q4">What is the "auxiliary classpath"? Why should I specify it?</a>
<li> <a href="#q5">The Eclipse plugin doesn't load</a>
<li> <a href="#q6">I'm getting a lot of false "OS" and "ODR" warnings</a>
<li> <a href="#q7">The Eclipse plugin loads, but doesn't work correctly</a>
<li> <a href="#q8">Where is the Maven plugin for FindBugs?</a>
<li> <a href="#q9">Where is the NetBeans plugin for FindBugs?</a>
</ol>
<h2><a name="q1">Q1: I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a></h2>
<p> FindBugs requires JRE 1.5.0 or later to run.&nbsp; If you use an earlier version,
you will see an exception error message similar to the following:
<pre>
Exception in thread "main" java.lang.UnsupportedClassVersionError:
edu/umd/cs/findbugs/gui/FindBugsFrame (Unsupported major.minor version 48.0)
</pre>
The solution is to upgrade to JRE 1.5.0 or later.
<h2><a name="q2">Q2: When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a></h2>
<p> The symptom of this bug is that when you start the FindBugs analysis,
you see an exception similar to the following:
<pre>
java.lang.NoSuchMethodError: org.apache.bcel.Repository.setRepository(Lorg/apache/bcel/util/Repository;)V
at edu.umd.cs.findbugs.FindBugs.clearRepository(FindBugs.java:483)
...
</pre>
or
<pre>
java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
...
</pre>
<p> The problem here is that the wrong version of the
<a href="http://jakarta.apache.org/bcel/">Apache BCEL</a>
library is being found.&nbsp; FindBugs requires its own
version of BCEL, which normally will be used automatically
when you invoke the <code>findbugs</code> or <code>findbugs.bat</code>
scripts used to launch FindBugs.&nbsp; If an old version of BCEL is installed
in a location, such as "lib/endorsed" in the JRE installation,
where it overrides classes on the application classpath,
FindBugs will not execute properly.&nbsp;
We know of several reasons this could happen
<ul>
<li> If you install the
<a href="http://java.sun.com/webservices/downloads/webservicespack.html">Java(TM) Web Services
Developer Pack 1.2</a>
in the <code>lib/endorsed</code> directory of your Java Runtime Environment (JRE).&nbsp;
The file <code>xsltc.jar</code> contains an old version of BCEL that is incompatible with
FindBugs.&nbsp;
<li> Another possibility is that you are using the IBM JDK.&nbsp;
Some versions include a version of BCEL which conflicts with the
one required by FindBugs.&nbsp; This problem is fixed in version 1.4.1 SP1,
so upgrading your JDK should allow FindBugs to run correctly.
<li> Some versions of the Apache Xalan XSLT processor include
an old version of BCEL in <code>xalan.jar</code>.
</ul>
<p> In all of these cases, you should be able to run FindBugs
by either removing the offending version of BCEL from your JRE,
or installing a clean JRE or JDK and using that to run FindBugs.
<p> Many thanks to Peter Meulmeester, Michael Levi, and Thomas Klaeger
for providing information on this problem.
<h2><a name="q3">Q3: FindBugs is running out of memory, or is taking a long time to finish</a></h2>
<p> In general, FindBugs requires lots of memory and a relatively
fast CPU. For large applications, 512M or more of heap space may be
required. By default, FindBugs allocates 256M of heap space.
You can increase this using the <code>-maxHeap <i>n</i></code> option,
where <i>n</i> is the number of megabytes of heap space to allocate.
<h2><a name="q4">Q4: What is the "auxiliary classpath"? Why should I specify it?</a></h2>
<p> Many important facts about a Java class require information about
the classes that it references.&nbsp; For example:
<ul>
<li> What other classes and interfaces the class inherits from
<li> What exceptions can be thrown by methods in external classes
and interfaces
</ul>
<p> The "auxiliary classpath" is a list of Jar files, directories, and
class files containing classes that are <em>used</em> by the code you
want FindBugs to analyze, but should not themselves be analyzed
by FindBugs.
<p> If FindBugs doesn't have complete information about referenced classes,
it will not be able to produce results that are as accurate as possible.&nbsp;
For example, having a complete repository of referenced classes allows
FindBugs to prune control flow information so it can concentrate on
paths through methods that are most likely to be feasible at runtime.&nbsp;
Also, some bug detectors (such as the suspicious reference comparison detector)
rely on being able to perform type inference, which requires complete
type hierarchy information.
<p> For these reasons, we strongly recommend that you completely specify
the auxiliary classpath when you run FindBugs.&nbsp; You can do this
by using the <code>-auxclasspath</code> command line option, or the
"Classpath entries" list in the GUI project editor dialog.
<p> If FindBugs cannot find a class referenced by your application, it
will print out a message when the analysis completes, specifying the
classes that were missing.&nbsp; You should modify the auxiliary classpath
to specify how to find the missing classes, and then run FindBugs again.
<h2><a name="q5">Q5: The Eclipse plugin doesn't load</a></h2>
<p> The symptom of this problem is that Eclipse fails to load
the FindBugs UI plugin with the message:
<blockquote>
Plug-in "edu.umd.cs.findbugs.plugin.eclipse" was disabled due to missing or disabled
prerequisite plug-in "org.eclipse.ui.ide"
</blockquote>
<p> The reason for this problem is that the Eclipse
plugin distributed with FindBugs
does not work with 2.x versions of Eclipse.
Please use Eclipse version 3.3 (June 2007) or newer.
<h2><a name="q6">Q6: I'm getting a lot of false "OS" and "ODR" warnings</a></h2>
<p> By default, FindBugs assumes that any method invocation can
throw an unchecked runtime exception.&nbsp; As a result,
it may assume that an unchecked exception thrown out of the
method could bypass a call to a <code>close()</code> method
for a stream or database resource.
<p> You can use the <code>-workHard</code> command line argument
or the <code>findbugs.workHard</code> boolean analysis property
to make FindBugs work harder to prune unlikely exception
edges.&nbsp; This generally reduces the number of
false warnings, at the expense of slowing down the
analysis.
<h2><a name="q7">Q7: The Eclipse plugin loads, but doesn't work correctly</a></h2>
<p> In versions 0.0.6 and 0.0.7 of the FindBugs Eclipse plugin,
which correspond to the 0.7.4 and 0.8.0 releases,
bugs in the experimental SwitchFallthrough detector can prevent
FindBugs from running properly within Eclipse.
<p> To work around the problem, make sure that SwitchFallthrough
is disabled in the FindBugs Properties of your project.&nbsp;
Right click on your project, and choose "Properties".&nbsp;
In the Properties dialog, choose "FindBugs",
and disable the checkbox next to SwitchFallthrough.
<p> Another common problem with the Eclipse plugin is that
the FindBugs warnings do not appear in the "Problems" view.&nbsp;
Make sure that FindBugs warnings are enabled in the filters
for this view.&nbsp; The Filters menu is accessible by
clicking on the icon that looks like this:
<blockquote>
<img src="eclipse-filters-icon.png">
</blockquote>
Make sure the "FindBugs Problem" checkbox is enabled.
<h2><a name="q8">Q8: Where is the Maven plugin for FindBugs?</a></h2>
<p>
The <a href="http://maven.apache.org/">Maven</a> Plugin for FindBugs
may be found <a href="http://mojo.codehaus.org/findbugs-maven-plugin/">here</a>.&nbsp;
Please note that the Maven plugin is not maintained by the FindBugs developers,
so we can't answer questions about it.
</p>
<h2><a name="q9">Q9: Where is the NetBeans plugin for FindBugs?</a></h2>
<p>We recommend <a href="http://kenai.com/projects/sqe/pages/Home">SQE: Software Quality Environment</a>
which bundles FindBugs, PMD and CheckStyle. Use the following
update site:
<a href="http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml
">http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml</a>a>
<p>Pease note that the SQE plugin is not maintained by the FindBugs developers,
so we can't answer questions about it.
</p>
<hr> <p>
<script language="JavaScript" type="text/javascript">
<!---//hide script from old browsers
document.write( "Last updated "+ document.lastModified + "." );
//end hiding contents --->
</script>
<p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a>
<p>
<A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?group_id=96405&amp;type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></A>
</td>
</table>
</body>
</html>