Ideyatech Logo

Java Code Analysis using FindBugs

October 2008 Posted by Jaycobb Cruz

Are you familiar with common mistakes such as checking equality of two Strings on Java using “==”? Or calling an instance method of a null object? They may look like obvious cases of bugs but many developers are unaware or unconsciously make these kind of codes.

Static code analysis tools, such as FindBugs inspects and analyzes Java bytecode and highlights possible coding errors, bad practice, correctness, malicious code vulnerability, multithreaded correctness, performance, security and dodgy codes without actually running the program.

FindBugs can be downloaded for free. To use FindBugs using the Swing interface, you can execute/run findbugs.sh (on Unix) or findbugs.bat (on Windows) from the bin folder.
1. When the application starts, click File – New Project.
2. On “Class archives and directories to analyze” click Add button, then choose the root folder that contains the compiled classes of your program.
3. On “Source directories”, click the Add button then choose the root folder of the source of your program.
4. Click Finish. FindBugs will scan and analyze all the classes of the program you specified.

After analyzing, FindBugs will show all the potential bugs detected grouped into different categories. When you select a particular bug, it will display the detailed description of the potential bug.

Static Code Analysis Using FindBugs

Static Code Analysis Using FindBugs

Related Posts with Thumbnails

One Response to “Java Code Analysis using FindBugs”

  1. April 22, 2010  |  10:06 am

    [...] No more syntax error Common mistakes in java is to compare 2 String objects using "==" or "!=". Java IDEs will not prompt you of these errors. Lucky for you there is a software that can help you. That software is called FindBugs. FindBugs analyzes your code and highlights possible coding errors and code used in bad practice. And it does this without even compiling the code! You can download FindBugs here. To find out more about FindBugs click here. [...]

Leave a Reply

Copyright © 2012 Ideyatech, Inc. All Rights Reserved.