Finding bugs in your code using FindBugs

Static code analysis is the analysis of the software that is performed without actually executing the program. The process provides an understanding of the code structure and can help to ensure that the code adheres to industry standards. Static analysis code reviews compare the source code of an application with a set of standards to ensure the source code compiles with those standards, to find unwanted dependencies, and to ensure that the intended structural design of the code is maintained. The main advantage of static analysis is the fact that it can reveal errors that do not manifest themselves until a disaster occurs. Static analysis is only a first step in a comprehensive software quality regime.

Continue reading “Finding bugs in your code using FindBugs”

Test Post: posting source code

Sample source code

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code initially collapsed

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Sample source code with line highlighting

public class MyClass
{
   public static void main(String args[])
   {
      System.out.println("Hello World...!");
    }

}

Link to my article on how to do this.

Installing Jadclipse in Eclipse

Today I am going to show you how to install and use Jadclipse. Jadclipse is eclipse plug-in that integrates Jad (Java decompiler) with Eclipse.

  • First you require Jad for decompiling java files. You can find a list of mirrors on this site where you can get JAD for various platforms. Download it and unzip into any folder on your hard drive.
  • Next download the Jadclipse plug-in jar file from here and place the jar file in your eclipse plugins folder
  • Restart your eclipse. If eclipse didn’t recognize the plug-in then launch eclipse with -clean flag.

eclipse -clean

  • Configure the path to the Jad executable in eclipse under Window > Preferences… > Java > JadClipse > Path to Decompiler.
  • Set the full path of the jad executable, e.g. C:\Program Files\Jad\jad.exe
  • Go to Window > Preferences… > General > Editors > File Associations and make sure that the JadClipse Class File Viewer has the default file association for *.class  files.
Jad preferences
Jad preferences in eclipse running under mac.
file association
file association

Now everything is done. If you want to view the source for any class then simply ctrl+click on that class then the source for that class will be showed in your eclipse editor.

Reading from CLOB in java through JDBC

Here is a code snippet that I have used to read from a CLOB, Oracle 10g instance.

PreparedStatment ps = connection.prepareStatement
("SELECT clobcolumn from clobtable");
ResultSet rs = ps.executeQuery();
while(rs.next())
{
oracle.sql.CLOB clobValue = (oracle.sql.CLOB)rs.getCLOB(1);
BufferedReader reader = new BufferedReader(new
InputStreamReader(clobValue.getAsciiStream()));
String read = null;
StringBuffer buffer = new StringBuffer();
while((read = reader.readLine()) != null )
{
buffer.append(read);
}
}
Digg This

Installing Eclipse SQL Explorer Plug-in in Eclipse Ganymede (Eclipse 3.4)

This is an updated post for my earlier post Installing Eclipse SQL Explorer Plug-in for installing Eclipse SQL Explorer plug-in in Eclipse 3.4

Eclipse version 3.4
Eclipse SQL Explorer version 3.5.0

Installing using the Eclipse update manager.

  • From the Eclipse menu select Help->Software Updates…
Photobucket

  • Software Updates and Add-ons dialogue box will be displayed. Select the Available Software tab on the top of the dialogue box. Now Click on the Add Site button on the right hand side of the dialogue box.
Photobucket

Photobucket

  • It will search and present you with available software
Photobucket

  • Select the features you want to install . In this case select the branch, it will also install the patch and click on the Install button on the top right hand side.
  • It will check for dependencies if any and will present to you what all you need to install.
Photobucket

  • Confirm the plug-ins you want to install and click next
Photobucket

  • Accept the license agreement and click on Finish.
Photobucket

After the installation is done it will ask to restart the workbench, restart the workbench. To open the Eclipse SQL Explorer perspective from the menu select Window->Open Perspective->Other. From the list of perspectives select Sql Explorer and click on ok, you will be switched to SQl Explorer Perspective.
Photobucket

Technorati Tags: , ,