You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Thomas-W Hofmann <th...@db.com> on 2007/02/16 09:31:16 UTC

Fix for locale date picker error

Hi,

drilling down the reported error in 
http://opensource.atlassian.com/projects/roller/browse/ROL-1341

I found the following:

In BasePageModel the following method is used :

    public String getShortDateFormat()
    {
        DateFormat sdf = DateFormat.getDateInstance(
                DateFormat.SHORT, request.getLocale());
        if (sdf instanceof SimpleDateFormat)
        {
            return ((SimpleDateFormat)sdf).toLocalizedPattern();
        }
        return "yyyy/MM/dd";
    }

This is causing the problem because it returns a pattern that in the end 
cannot be used :
return ((SimpleDateFormat)sdf).toLocalizedPattern();

This should read 
return ((SimpleDateFormat)sdf).toPattern();

which fixes the problem.
Seems to be a little overengineered as sdf at this point already is 
localized

best regards
Thomas





--

Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Re: Fix for locale date picker error

Posted by Dave <sn...@gmail.com>.
Thanks Thomas. That makes my job easy. I'll get it in to trunk, 3.1 and beyond.

- Dave


On 2/16/07, Thomas-W Hofmann <th...@db.com> wrote:
> Hi,
>
> drilling down the reported error in
> http://opensource.atlassian.com/projects/roller/browse/ROL-1341
>
> I found the following:
>
> In BasePageModel the following method is used :
>
>     public String getShortDateFormat()
>     {
>         DateFormat sdf = DateFormat.getDateInstance(
>                 DateFormat.SHORT, request.getLocale());
>         if (sdf instanceof SimpleDateFormat)
>         {
>             return ((SimpleDateFormat)sdf).toLocalizedPattern();
>         }
>         return "yyyy/MM/dd";
>     }
>
> This is causing the problem because it returns a pattern that in the end
> cannot be used :
> return ((SimpleDateFormat)sdf).toLocalizedPattern();
>
> This should read
> return ((SimpleDateFormat)sdf).toPattern();
>
> which fixes the problem.
> Seems to be a little overengineered as sdf at this point already is
> localized
>
> best regards
> Thomas
>
>
>
>
>
> --
>
> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.