Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-release > by-pkgid > 95f5ae0ce06780fd3cab0be9375c9914 > files > 48

findbugs-manual-1.2.1-1.1.4mdv2008.1.x86_64.rpm

<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter&nbsp;4.&nbsp;Using the FindBugs&#8482; Graphical User Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="FindBugs&#8482; Manual"><link rel="up" href="index.html" title="FindBugs&#8482; Manual"><link rel="prev" href="building.html" title="Chapter&nbsp;3.&nbsp;Building FindBugs&#8482; from Source"><link rel="next" href="textui.html" title="Chapter&nbsp;5.&nbsp;Using the FindBugs&#8482; Command Line Interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;4.&nbsp;Using the <span class="application">FindBugs</span>&#8482; Graphical User Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="building.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="textui.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="gui"></a>Chapter&nbsp;4.&nbsp;Using the <span class="application">FindBugs</span>&#8482; Graphical User Interface</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="gui.html#d0e868">1. Creating a Project</a></span></dt><dt><span class="sect1"><a href="gui.html#d0e910">2. Running the Analysis</a></span></dt><dt><span class="sect1"><a href="gui.html#d0e915">3. Browsing Results</a></span></dt><dt><span class="sect1"><a href="gui.html#d0e944">4. Loading and saving results</a></span></dt></dl></div><p>
<span class="application">FindBugs</span> has two user interfaces: a graphical user interface (GUI) and a
command line user interface.  This chapter describes the graphical user interface.
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e868"></a>1.&nbsp;Creating a Project</h2></div></div></div><p>
After you have started <span class="application">FindBugs</span> using the <span><strong class="command">findbugs</strong></span> command,
choose the <span class="guimenu">File</span> &#8594; <span class="guimenuitem">New Project</span>
menu item.  You will see a dialog which looks like this:
</p><div class="mediaobject"><img src="project-dialog.png"></div><p>
</p><p>
Use the "Browse" button next to the "Add archive or directory" text field to select a Java archive
file (zip, jar, ear, or war file) or directory containing java classes to analyze for bugs.  You may add multiple
archives/directories.
</p><p>
You can also add the source directories which contain
the source code for the Java archives you are analyzing.  This will enable
<span class="application">FindBugs</span> to highlight the source code which contains a possible error.
The source directories you add should be the roots of the Java
package hierarchy.  For example, if your application is contained in the
<code class="varname">org.foobar.myapp</code> package, you should add the
parent directory of the <code class="filename">org</code> directory
to the source directory list for the project.
</p><p>
Another optional step is to add additional Jar files or directories as
classpath entries.  You should do this if the archives and directories you are analyzing
have references to other classes which are not included in the analyzed
archives/directories and are not in the standard runtime classpath.  Some of the bug
pattern detectors in <span class="application">FindBugs</span> make use of class hierarchy information,
so you will get more accurate results if the entire class hierarchy is
available which <span class="application">FindBugs</span> performs its analysis.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e910"></a>2.&nbsp;Running the Analysis</h2></div></div></div><p>
Once you have added all of the archives, directories, and source directories,
click the "Find Bugs!" button to analyze the classes contained in the
Jar files.  Note that for a very large program on an older computer,
this may take quite a while (tens of minutes).  A recent computer with
ample memory will typically be able to analyze a large program in only a
few minutes.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e915"></a>3.&nbsp;Browsing Results</h2></div></div></div><p>
When the analysis completes, you will see a screen like the following:
</p><div class="mediaobject"><img src="example-details.png"></div><p>
</p><p>
The top pane of the window shows the bug tree; this is a hierarchical
representation of all of the potential bugs detected in the analyzed
Jar files.  The tabs allow you to browse by class, package, or bug type.
</p><p>
When you select a particular bug instance in the top pane, you will
see a description of the bug in the "Details" tab of the bottom pane.
In addition, the "Source code" tab of the bottom pane will, for some
kinds of bugs, show the program source code where the potential bug occurs.
In the above example, the bug is an access to an uninitialized field in
a constructor.  The source code window highlights the line containing
the problematic access.
</p><p>
You may add a textual annotations to bug instances.  To do so, choose the
"Annotations" tab in the bottom pane.  Simply type in any information which
you would like to record.  When you load and save bug results files,
the annotations are preserved.
</p><p>
You may use the <span class="guimenu">File</span> &#8594; <span class="guimenuitem">Save project</span>
menu option to save the current lists
of Jar files and source directories.  A saved project may be loaded with
the <span class="guimenu">File</span> &#8594; <span class="guimenuitem">Open project</span> menu option.
Note that when you save a project, the analysis results are
not saved.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e944"></a>4.&nbsp;Loading and saving results</h2></div></div></div><p>
You may use the <span class="guimenu">File</span> &#8594; <span class="guimenuitem">Load bugs</span>
and <span class="guimenu">File</span> &#8594; <span class="guimenuitem">Save bugs</span> to load
and save the bug results produced by running <span class="application">FindBugs</span> on your project.  The results are
saved in XML format.  Any annotations you have added to bug reports are saved in the
resulting XML file.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note: Planned Features"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="note.png"></td><th align="left">Planned Features</th></tr><tr><td align="left" valign="top"><p>
Support for loading and saving bugs is still under development.
You may find bugs in this feature, and the file format and/or implementation
may change in future releases.
</p></td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="building.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="textui.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;3.&nbsp;Building <span class="application">FindBugs</span>&#8482; from Source&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;5.&nbsp;Using the <span class="application">FindBugs</span>&#8482; Command Line Interface</td></tr></table></div></body></html>