Image

Imagetrajano wrote in Imagejava_dev

My first bug in commons-lang

Just added my first bug in commons-lang. Actually its more of an enhancement rather than a problem, but Bugzilla calls all of them bugs.

Its a smallish code snippet that would allow me to format one way and parse another. It gets rid of me writing the code:

DateFormat parser = new SimpleDateFormat("...format A...");
DateFormat formatter = new SimpleDateFormat("...format B...");
Date foo = parser.parse(getFromWeb());
String bar = formatter.format(foo);


Reducing it to

Format doh = new CompositeFormat(new SimpleDateFormat("...format A..."),new SimpleDateFormat("...format B..."));
Date foo = doh.parse(getFromWeb());
String bar = doh.format(foo);


That may seem like overkill, but its more usueful if you want to create a set of constant formatters which would combine the formatting for you.