Showing posts with label Eclipse tools. Show all posts
Showing posts with label Eclipse tools. Show all posts

Saturday, September 21, 2013

FindBug Installation : URL based Installation :


FindBug Installation : URL based Installation :

Step 1 : Go to eclipse Help ---->Install New Software










Step 2 : Use the Url  http://findbugs.cs.umd.edu/eclipse to put into 'Work with'  input field .
Click on  Add Button



Step 3: Fill the Name field with 'Findbug'



Step 4 : Click on Select All option /Or Select the appropriate version and then click next




Step 4: Accept the Agreement





Step 5 : Click Ok




Step 6 : Restart the Eclipse


Thursday, September 19, 2013

Why to Use Findbugs ,PMD and Checkstyle ?


PMD works on source code and therefore finds problems like: violation of naming conventions, lack of curly braces, misplaced null check, long parameter list, unnecessary constructor, missing break in switch, etc. PMD also tells you about the Cyclomatic complexity of your code which I find very helpful (FindBugs doesn't tell you about the Cyclomatic complexity).

FindBugs works on bytecode. Here are some problems FindBugs finds which PMD doesn't: equals() method fails on subtypes, clone method may return null, reference comparison of Boolean values, impossible cast, 32bit int shifted by an amount not in the range of 0-31, a collection which contains itself, equals method always returns true, an infinite loop, etc.
Usually each of them finds a different set of problems. Use both. These tools taught me a lot about how to write good Java code.

Checkstyle : The programming style adopted by a software development project can help to comply with good programming practices which improve the code quality, readability, re-usability, and reduce the cost of development.

Sonar will run CheckStyle, FindBugs and PMD, as well as a few other "plugins" such as Cobertura (code coverage) by default for Java projects. The main advntage is that it stores the history in a database. You can then see the trend

Summery : Conventions (Checkstyle) / Bad practices (PMD) / Potential bugs (FindBugs) .

Thursday, August 15, 2013

Running a Debug in Eclipse: (Also useful for Remote Java application)



Running a Debug in Eclipse:

(Also useful for Remote Java application)

We just need to connect the sourcecode in eclipse to your eclipse debug (that will automatically detect a running tomcat on your machine) .

*   Open Eclipse 
* Select Debug Configuration (below the Bug Picture)
It opens the following  panel
Select the Remote Java Applications menu from the left panel
Fill the name of the debug in which you want to run
Browse and select the source code on which debug should run
(P.S. You don’t need to change Host and Port generally for any tomcat running on local system)
Click on Debug , and its  Done .

* Note : If an error message appears like following  then your debug is already running.


Go to debug perspective (For both purpose either to close or look into already running Debug)

And Click on this symbol to close the already running Debugger .


Or To Use the Debug , Do some action on the web application ,like in my case I am submitting a form


The Debug appears at the point you added the debug




Press F8 (which is also Resume button),that will take you to the break point from there debug each line with F6.
If you want to go to next break point press F8.