Disponível somente no TrabalhosFeitos
  • Páginas : 18 (4298 palavras )
  • Download(s) : 0
  • Publicado : 31 de agosto de 2012
Ler documento completo
Amostra do texto
Evaluation of FindBugs
The static analysis tool that finds bugs
Square Root 4/8/2009

Square Root Analysis: A10

Overview of FindBugs
FindBugs is an open source program which employs static analysis to indentify a multitude of potential errors in Java programs. The unique nature of this tool is that performs its analysis on byte code, rather than source code. Its installation and use willbe explored in subsequent sections of this paper. FindBugs can detect the bug patterns shown in the following table. Description AM: Creates an empty jar file entry AM: Creates an empty zip file entry BC: Equals method should not assume anything about the type of its argument BC: Random object created and used only once BIT: Check for sign of bitwise operation CN: Class implements Cloneable butdoes not define or use clone method CN: clone method does not call super.clone() CN: Class defines clone() but doesn't implement Cloneable Co: Abstract class defines covariant compareTo() method Co: Covariant compareTo() method defined DE: Method might drop exception DE: Method might ignore exception DP: Classloaders should only be created inside doPrivileged block DP: Method invoked that should beonly be invoked inside a doPrivileged block Dm: Method invokes System.exit(...)

Application of FindBugs
FindBugs is a tool that is available for utilization in two flavors: • Standalone application • Eclipse plug-in Since anything but the simplest projects can quickly overwhelm developers of an organization, and because Eclipse was also being utilized for the development of our Studioproject, it was quite apparent that our proclivity would be towards exploration of the Eclipse plug-in rather than use of the tool as a standalone application. Following is an exposition of the steps required for the installation of the tool: • The plug-in was available from the site: http://findbugs.cs.umd.edu/eclipse. Installation of the tool requires the following sequential operations: o Select theHelp menu o Click on Software Updates 2

Square Root Analysis: A10 o Click on the tab labeled ‘Available Software’ o Upload the link for the aforementioned site o Click Install, the process of which will necessitate a restart of the application Following is an exposition of the steps that were necessitated for the execution of the tool: • Commencement of static analysis by the tool can beachieved by right clicking on either the: o The Java project o The Java package o The Java class • Once the tool is executed the results can be viewed. A prerequisite for observing the results is the enabling of label decorations for the project/package/file. To carry out this operation: o Go to Window->Preferences->General-Appearance->Label Decorations o Enable the following Check Boxes

Theresults can be viewed by opening the FindBugs perspective. To do this select Window->Open Perspective->FindBugs


Square Root Analysis: A10

Following is an example of the results that were obtained for a specific project:

By default, the tool performs a large variety of analyses before yielding results. Consequently, it isn’t uncommon for the tool to throw up a large number ofpotential bugs, the magnitude of which can quickly impede the analysis of the results. To overcome these problems, users of the tool are faced with two options: • Filter the results of the tool in order to analyze specific bug patterns • Configure the tool so that it is restricted to finding only certain bugs that are of interest to the user. To filter the results to view certain bug patterns: • Selectthe FindBugs perspective. • Select the bug pattern that isn't of relevance • Right click on it to show the "Toggle Filter" menu. • Select one of two toggle actions: o "This Specific Bug Pattern" action will toggle on/off only one, specific bug pattern o "Bug Pattern Type" action will toggle the whole group of patterns on/off


Square Root Analysis: A10

To modify the configuration of...
tracking img