Monday, October 7, 2013

What is FindBugs?

FindBugs is a static analysis tool for Java ( It can be downloaded here.)
Static analysis tools ascertains possible errors in the Source code of the program  without actually executing the program.This helps developers to test parts of the software that they have coded without having to wait for all the modules of the software to be integrated together to run tests that expose faults.

There are several static analysis tools available for Java (see list  here).So what makes FindBugs so special?Well, one of the factors that sets FindBugs apart from other static analysis tools is that the number of False Positives reported in the Source code by FindBugs is minimal. 
In the paper, “Finding More Null Pointer Bugs, But Not Too Many” written by David Hovemeyer and Willian Pugh, the writers explain new techniques such as :
1. Suppressing warnings inside try/catch blocks- If a lines that could cause potential errors(such as NullPointerException in Java) is already handled by enclosing them in a try-catch block, then FindBugs does not report such lines as potential fault points.
2.  Better handling of assertions- If assert statements are already included in the code and assertions are enabled then FindBugs does not generate warnings for the same.
3.  Better handling of panic methods calls- If panic Methods are already coded to handle possible errors, FindBugs does not generate warnings to identify the same thus making its reports less verbose.
Use of above techniques in FindBugs makes it far more efficient than other static analysis tools( The above mentioned paper compares Null Pointer Analysis of FindBugs with another static analysis tool called Reasoning on Tomcat 4.1.24.It can be downloaded here).

Furthermore, comparative studies made by Peng Li and Baojiang Cui in their paper “A comparative study on software vulnerability static analysis techniques and tools”, at the Information Theory and Information Security (ICITIS), 2010 IEEE International Conference suggest that by using techniques such as Lexical Analysis –which divides the entire program into small fragments and verify the structure for each of these fragments against predetermined rules( such as Grammars as done by compilers) and Data Flow Analysis –a technique that collects semantic information from program code to determine whether a value in a variable is assigned to a possible vulnerability of the corresponding variable (such as a Null value in a variable that holds Object references in Java), FindBugs has the ability to report far more pitfalls and errors in the source code than many other Static analysis tools for Java.
In days to come, we will discuss how we tested FindBugs on a portion of an Open Source software and we will share our results and findings.

No comments:

Post a Comment