How to use plugin FindBugs in Eclipse

How to use Eclipse plugin FindBugs, which is a very popular plugin for source code analysis.

Plugin Findbugs is very popular plugin for source code analysis. First you must install this plugin from Eclipse Marketplace as described in previous screencast.

Next goto Window -> Preferences and choose Java -> Findbugs. There you can customize how serious bugs will Findbugs report. Set this so it will report all bugs.

Now if you want to check your code for bugs, right click on your project and choose Find Bugs -> Find Bugs. Bugs will appear in your code and you can try to fix them. Also you can review all bugs in one place.

Each bug has some description. As you can see, I forgot to close this stream. So I'll correct this problem. Now I'll re-run FindBugs.

Now I created another possible bug. This outStream can be null and you can't call method on a null object. So I must check if outStream is different than null.

Now you can see that I resolved all bugs.