public static void initialize ( ) { PrivilegedAction action = new PrivilegedAction ( ) { public Object run ( ) { String defaultFormat = System . getProperty ( "org.jboss.util.propertyeditor.DateEditor.format" , "MMM d, yyyy" ) ; String defaultLocale = System . getProperty ( "org.jboss.util.propertyeditor.DateEditor.locale" ) ; DateFormat defaultDateFormat ; if ( defaultLocale == null || defaultLocale . length ( ) == 0 ) { defaultDateFormat = new SimpleDateFormat ( defaultFormat ) ; } else { defaultDateFormat = new SimpleDateFormat ( defaultFormat , Strings . parseLocaleString ( defaultLocale ) ) ; } formats = new DateFormat [ ] { defaultDateFormat , // Tue Jan 04 00:00:00 PST 2005 new SimpleDateFormat ( "EEE MMM d HH:mm:ss z yyyy" ) , // Wed, 4 Jul 2001 12:08:56 -0700 new SimpleDateFormat ( "EEE, d MMM yyyy HH:mm:ss Z" ) } ; return null ; } } ; AccessController . doPrivileged ( action ) ; }
Setup the parsing formats . Offered as a separate static method to allow testing of locale changes since SimpleDateFormat will use the default locale upon construction . Should not be normally used!