DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32904>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32904

           Summary: <i18n:formatDate /> does not handle locale changes
                    properly - fix included here
           Product: Taglibs
           Version: nightly
          Platform: All
        OS/Version: Mac OS X 10.3
            Status: NEW
          Severity: major
          Priority: P2
         Component: I18N Taglib
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


<i18n:formatDate /> does not handle Locale changes properly in Tomcat/5.0.16 on
Mac OS X 10.3.6 because the Locale is cached (actually, the DateFormat is
cached, but it ends up causing the same problem). 

The problem is in i18n.FormatDateTag, right here: 

/** If no [EMAIL PROTECTED] java.text.DateFormat} is configured then use a 
      * [EMAIL PROTECTED] SimpleDateFormat} instance if a pattern is configured 
else
      * use the default DateFormat for the [EMAIL PROTECTED] java.util.Locale}
      */
    public Format getFormat() {
        /* if ( format == null ) { */
            String pattern = getPattern();
            if ( pattern != null ) {
                format = getPatternFormat( pattern );
            }
            if ( pattern == null ) {
                format = getDateFormat();
            }
       /* } */
        return format;
    }

When tags are pooled(?) the variable 'format' gets set the first time the tag is
used in the container, and can then not be changed. The fix is to do what I did
above - that is, take out the check for 'format' being null and simply redo the
formatting every time. 

Note that <i18n:formatDateTime /> works fine.  I used both tags on the same page
and switched my locale back and forth.  <i18n:formatDateTime /> responds to the
change in Locale, but <i18n:formatDate /> does not.  My fix (above) solves this
problem.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to