FindBugs Tutorial

FindBugs is an useful tool that can find potential problematic code in your Java program. It differs from CheckStyle and PMD in that it analyzes Java bytecode, not the human-readable source file, to find potential bug patterns. Follow this tutorial to see how to use FindBugs in Eclipse!

1. In Eclipse, click Help -> Install new software. In the opened dialogue, click "Add". Type in FindBugs as the name and "http://findbugs.cs.umd.edu/eclipse" as the URL. Click "OK" to proceed.

2. Select "FindBugs" and click "Next"

3. Eclipse will begin downloading the software. Agree to any prompted licenses or user agreements to proceed.

4.  Right-click the project, select Find Bugs -> Find Bugs in the context menu.

5. Wait a few seconds/minutes while it checks your project

6. When finished, it will report how many bugs it has found. Click "yes" to open the FindBugs perspective to view the bugs.

7. In the Bug Explorer window, you can see a summary of the bugs found.

8. Double click one bug to see exactly which line is problematic. Here it says two strings should be compared with the "equals()" method, not the  "==" operator.

9. Make changes accordingly, and check again to make sure there are no more bugs.

That‘s all for this tutorial. Hopefully you‘ll find it useful. More information about FindBugs can be found at http://findbugs.sourceforge.net/.

Feedbacks and suggestions are greatly appreciated.

时间: 05-21

FindBugs Tutorial的相关文章

eclipse插件之Findbugs、Checkstyle、PMD安装及使用

一.什么是Findbugs.checkstyle.PMD Findbugs.checkstyle和PMD都可以作为插件插入eclipse,当然也有单独的工具可以实现他们的功能,比如Findbugs Tool就可以不必插入eclipse就可以使用. 三者的功能如下表: 工具 目的 检查项 FindBugs 检查.class 基于Bug Patterns概念,查找javabytecode(.class文件)中的潜在bug 主要检查bytecode中的bug patterns,如NullPoint空指

初译 Support Vector Machines:A Simple Tutorial(一)

从本次开始我将开始尝试着逐章翻译一下 Alexey Nefedov的<Support Vector Machines:A Simple Tutorial>这本教材,这可是我们导师极力推荐的SVM教材,看了好久一直感觉一脸懵逼,索性开坑翻译一下吧,也当是加深理解,毕竟我也是一知半解,如果翻译的有不对的地方还望大佬们斧正,欢迎提意见,欢迎讨论. 嗯,就是这样. (一)Introduction 在本章节中将会介绍一些用于定义支持向量机(SVM)的基础的概念,这些概念对于理解SVM至关重要,假定读者了

ZetCode PyQt4 tutorial Dialogs

#!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PyQt4 tutorial In this example, we receive data from a QtGui.QInputDialog dialog. author: Jan Bodnar website: zetcode.com last edited: October 2011 """ import sys from PyQ

Findbugs - Eclipse插件

简介 Findbugs是一个在java程序中查找bug的程序,它查找bug模式的实例,也就是可能出错的代码实例,注意Findbugs是检查java字节码,也就是*.class文件.其实准确的说,它是寻找代码缺陷的,很多我们写的不好的地方,可以优化的地方,它都能检查出来.例如:未关闭的数据库连接,缺少必要的null check,多余的 null check,多余的if后置条件,相同的条件分支,重复的代码块,错误的使用了"==",建议使用StringBuffer代替字符串连加等等.而且我们

简单的LESS Tutorial

1. 什么是LESS? LESS是一种动态的CSS语言,更专业的称呼是CSS preprocessor.作为CSS的扩展语言,LESS可以让CSS文件逻辑上更清晰,从而更容易维护和更新.LESS是开源的,诞生于2009年,采用javascript开发, LESS深受另外一种动态CSS语言SASS/SCSS的影响(SCSS是SASS的升级版) .相对于SASS/SCSS或者其他CSS preprocessor, LESS的典型特征有两个, 支持实时编译,例如网页或者应用可以直接应用less文件,通

(翻译)deeplearning.net/tutorial —— 栈式去噪自编码器(SdA)

前言 栈式去噪自编码器是栈式自动编码器的扩展[Bengio07],并且它在[Vincent08]里有介绍. 这次教程建立在之前的去噪自编码器Denoising Autoencoders.如果你对自编码器没什么了解,建议你先了解一下. 栈式自编码器 通过把上一层去噪自编码器找到的隐藏输入(output code)当作下一层的输入,我们可以把去噪自编码器以栈的形式构成一个深度网络.这种无监督预训练的结构在一层里同时实现.每一层当作一个去噪自编码器,通过重构输入(上一层的输出)最小化损失.一旦前面 层

A Complete ActiveX Web Control Tutorial

? Introduction ActiveX is a Microsoft technology developed in the mid 90's, that allows for the creation of applet-like applications that can be downloaded and run within Microsoft's Web browser. This article is intended for Visual C++ developers who

Eclipse中FindBugs插件的应用

1.插件下载 下载地址:http://findbugs.sourceforge.net/downloads.html 2.插件安装 安装比较简单,直接把下载的压缩包解压后,整个文件夹复制到eclipse目录下的dropins文件夹里. 3.插件使用 重启eclipse后,右键点击项目,弹出的框就多了Find Bugs的功能. 运行完Find Bugs命令需要切换到Bug Explorer视图里,查看找到的bug信息

PIC32MZ tutorial -- OC Interrupt

In my previous blog "PIC32MZ tutorial -- Output Compare", I shows how to apply Output Compare without interrupt to generate PWM signal. I also tried the Output Compare interrupt. I selected OC to be PWM mode without fault pin (OCM = "110&qu