Preemptive Error Detection with FindBugs

12
Preemptive Error Detection with FindBugs Albert Guo [email protected]

Transcript of Preemptive Error Detection with FindBugs

Page 1: Preemptive Error Detection with FindBugs

Preemptive Error Detection with FindBugsAlbert Guo

[email protected]

Page 2: Preemptive Error Detection with FindBugs

Agenda

• What is FindBugs

• Bug Categories

• How to use FindBugs

• Bugs Detection Process

• FindBugs Analysis Report

Page 3: Preemptive Error Detection with FindBugs

What is FindBugs

• FindBugs uses the Apache BCEL library to analyze the classes in your application and detect potential bugs.

• FindBugs rules (or "detectors") use a variety of inspection techniques, from examining the structure of the class right through to studying the detailed dataflow through the class.

• In addition to the detectors provided by FindBugs, with a bit of work, you can write your own custom-built detectors.

• http://findbugs.sourceforge.net/

Page 4: Preemptive Error Detection with FindBugs

Bug Categories

Page 5: Preemptive Error Detection with FindBugs

Bug Categories – cont.

Page 6: Preemptive Error Detection with FindBugs

How to use FindBugs

In practice, the standalone application is rarely used: developers prefer to be able to invoke FindBugs directly from within their work environment.

In practice, the standalone application is rarely used: developers prefer to be able to invoke FindBugs directly from within their work environment.

Page 7: Preemptive Error Detection with FindBugs

Bugs Detection Process http://findbugs.sourceforge.net/

Execute ant scriptExecute ant script

Page 8: Preemptive Error Detection with FindBugs

Bugs Detection Process – Author Ant Build Script

projectFile can be generated via GUI tool.http://0rz.tw/584k0 Get further info: http://0rz.tw/ed4mX  

projectFile can be generated via GUI tool.http://0rz.tw/584k0 Get further info: http://0rz.tw/ed4mX  

Build.xml

Attach.Attach.

Page 9: Preemptive Error Detection with FindBugs

Bugs Detection Process – Generate Bug Reports

….

Page 10: Preemptive Error Detection with FindBugs

FindBugs Analysis Report

Page 11: Preemptive Error Detection with FindBugs

FindBugs Analysis Report – cont.

Page 12: Preemptive Error Detection with FindBugs

FindBugs Analysis Report – cont.