maddingo/sojo — Issue #1: SOJO Date Formatting
Author: wcmatthysen
Created: 2011-12-19 12:25:32+00:00
State: open

Hi Martin,

I've tried to compile SOJO and I'm getting date-time formatting exceptions all over the show. For example, one such case is as follows:

testString2Date(test.net.sf.sojo.util.UtilTest) Time elapsed: 0.007 sec <<< ERROR!
java.lang.IllegalStateException: The String: "Mon Dec 19 14:18:03 SAST 2011" is not valid date.
at net.sf.sojo.util.Util.string2Date(Util.java:178)
at test.net.sf.sojo.util.UtilTest.testString2Date(UtilTest.java:35)

I suspect it is because the Util class (in net.sf.sojo.util) specifically adds the following formats in a static initializer block:

static {
addDateFormat2List(new SimpleDateFormat("EEE MMM dd HH:mm:ss 'CEST' yyyy", Locale.ENGLISH));
addDateFormat2List(new SimpleDateFormat("EEE MMM dd HH:mm:ss 'CET' yyyy", Locale.ENGLISH));
addDateFormat2List(new SimpleDateFormat("yyyy-MM-dd"));
addDateFormat2List(DateFormat.getDateInstance(DateFormat.MEDIUM));
}

which will only cater for CEST and CET dates. This will obviously cause an issue for people in other time zones. I will try to see if this can be fixed.

Regards,

Wiehann