30 December 2009

Top 5 Java tools I need to work

The year 2009 is ending. Time to reflect about my set of tools for Java development at COR&FJA.


IntelliJ IDEA
IntelliJ IDEA 9 Ultimate is a very good commercial IDE for Java professionals. It has outstanding support for Groovy and Grails development. Since version 9.0 IDEA comes in two different editions. The community edition is open source and free to use. The ultimate edition is the commercial release of IDEA.

dbUnit
dbUnit helps you writing integration tests which require a database. It lets you define specific dataset which can be added to the database before your tests start and removed after your tests have been completed.
A few months ago I started to use dbUnit as a database migration tool. I had the task to migrate a MySQL database to an Oracle database. After some research I decided to export the MySQL schema and importing it to Oracle using dbUnit. Well it perfectly worked out.

JIRA
After using JTrac and Mantis my employer finally decided to use JIRA as standard issue tracker. In my opinion JIRA is in a professional environment the Rolls Royce of issue trackers. Well at least in comparison with JTrac and Mantis :)

Hudson
After using Cruise Control I am really happy to have met Hudson. Setting up Hudson really is quick and easy. A simple setup wont take you more than five minutes. Comparing to Cruise Control this is a BIG plus and finally there is no bloody XML configration anymore.

Grails
It's the end of 2009. I am still a big Grails fan (as you probably have noticed). Grails is a wonderful web framework based on Groovy, Spring, Hibernate and Sitemesh which helps you to build web applications as fast as possible. Few days ago Grails 1.2 has been released.


Well these are the tools I personally like most. What tools do you like? Happy new year everyone!

8 December 2009

Unexpected behaviour of ArrayLists size method

Today I just learned something more about Javas ArrayList and my Debugger after an half an hour of trying to find out what is wrong with my code.
I had the strange situtation that the debugger told me that my list contained 6 elements but the size method of that list returned a value of 7 (see figure below). Apparently the ArrayList accepts null values without complaining about it and these null values are going to modify the size of the list but the debugger - in the case the debugger of IntelliJ IDEA 9 RC1 - filters null values and does not display them.




With the following listing you can reproduce this behaviour using IntelliJ IDEA (or your prefered IDE).

import java.util.ArrayList;
import java.util.List;

public class FunnyLists
{
   public static void main(String[] args)
   {
      List<String>
 list = new ArrayList<String>();
      list.add("Hello");
      list.add(null);
      list.add("World");        

      System.out.println("Size: " + list.size());

      for(String element : list) {
         System.out.println("Element: " + element);
      }
   }
}



This listing generates the following output:
Size: 3


Element: Hello
Element: null
Element: World