Simple Properties Files and Null Check


When performing a get on the properties from a property file,  If the property is entered, but the value is blank. e.g. file contains ‘field=’properties.get() returns ” If the property and its value is entered. e.g. file contains ‘field=value’properties.get() returns ‘value’ If the property is not entered into the property fileproperties.get() will return null. Lets the following code to demonstrate what I said just now. Tokenizer.java class Tokenizer { public static void main(String args[]) { Properties properties = new Properties(); ...

Caution: SimpleDateFormat


Every day at work teaches you something or the other. Today I learned something patterns, in general. A pattern used in a certain API doesn’t always consort with common sense. You actually should read the API first before using it in your application.In case you are into java, then you must have heard or even used a SimpleDateFormat. A SimpleDateFormat is widely used to convert a String into a Date(java.util.Date) according to a pattern. e.g. String dateAsString = “2012-01-06 12:23:34”;SimpleDateFormat sdf ...