You need a logger here rather than a printStackTrace(). Note that if the try block fails for any reason, getSimpleType will throw an IllegalArgumentException. As it is an unchecked exception, I'm not sure it should be caught too...