roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Johnson (JIRA)" <>
Subject [Roller-JIRA] Resolved: (ROL-1528) JVM's default locale cause EntryAdd and EntryEdit set pubTime to updateTime constantly
Date Fri, 10 Aug 2007 16:46:54 GMT


David Johnson resolved ROL-1528.

    Resolution: Fixed

Fixed in trunk for Roller 4.0

> JVM's default locale cause EntryAdd and EntryEdit set pubTime to updateTime constantly

> ---------------------------------------------------------------------------------------
>                 Key: ROL-1528
>                 URL:
>             Project: Roller
>          Issue Type: Bug
>          Components: User Interface - General
>            Reporter: David Johnson
>            Assignee: David Johnson
>             Fix For: 4.0
> From Miles Huang:
> The entryAdd and entryEdit action will have some strange behavior when jvm's
> default locale differ from en_US, for example, "zh_CN".
> When the pubTime is set by the client side calendar, entry add or edit
> operation will success, but the entry's pubTime is changed to updateTime
> constantly.
> In roller.log, following exception is logged:
> ERROR 2007-08-10 15:45:06,562 EntryBean:getPubTime - Error calculating
> pubtime
> java.text.ParseException: Unparseable date: "08/01/07"
>        at java.text.DateFormat.parse(
>        at
> org.apache.roller.weblogger.ui.struts2.editor.EntryBean.getPubTime(
> ...
> This is because the client side CalendarPopup and server side
> DateFormat.parse use different date format. The client side use "MM/dd/yy"
> format constantly. But in EntryBean.getPubTime, the DateFormat used to parse
> the date string is get by:
> DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
> It will return a DateFormat depending on the JVM default locale, which may
> not be "M/d/yy".
> And in the EntryBean.copyFrom, the date string generated for the
> setDateString should use "MM/dd/yy". But again, the actually used df is
> depending on the jvm's default locale. For example, in my environment, the
> default locale is "zh_CN", and the date string generated for edit is
> something like "07-6-30", which the CalendarPopup can not recognize.
> Solution is very simple, since the CalendarPopup can only recognize the
> "MM/dd/yy" format, hard code set the DateFormat using SimpleDateFormat
> directly. I've attached a patch file for this.
> Another little problem should be addressed is that even in the en_US default
> locale environment, the original code generate date sting using "M/d/yy"
> format, not "MM/dd/yy". Notice the slight difference will cause
> CalendarPopup can't auto locate to the date when popup,if the month or day
> value have only 1 digits.
> EntryBean.patch

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message