Hey Alan,

Let me see if I can straighten this out a bit.  Firstly, I think there's
been a straight up misconception somewhere.  Freddy's patch does not
pre-process the patterns.  DateFormatter will continue to pre-process the
user input (optionally now, but on by default).  It won't process the
patterns.  I just talked to Freddy because I'd gotten the wrong impression
here also, but it is as stated above.

Secondly, I /think/ this patch covers what most people would like to do. 
The big sticking point to date has been that in the JDK there are ways to
get DateFormat objects for the locale specific SHORT/MEDIUM/LONG formats,
but no way to get the format strings (stupid, I know).  So they couldn't
just be added to the top of the format string list, cos they're not
Strings, they're DateFormat instances.

The changes Freddy has supplied will work just as in 1.4 unless you
consciously choose to do something (at my insistence - I didn't want to
have to futz at upgrade time).  The new logic is essentially:

1. Look for a set of patterns in the properties file, and if there, use
them to make DateFormats and don't include /any/ other formats

2. If they're not in the properties file, fall back to 1.4 style behaviour
of using getFormatStrings() to supply format Strings, and then put the
locale specific DateFormats on top of those in getDateFormats()

I haven't looked line by line at the patch, but I'm hoping there's also a
way to override the method in #1 to just produce a list of DateFormats
from your own list of patterns by simply subclassing.

If you're still not sure, can you hop on IRC (Freddy, Ben, myself and
others are all there) so we can sort things out?  Cheers,

-t


----- Original Message -----
Subject: [Stripes-dev] [JIRA] Commented: (STS-443) Stripes
DateTypeConvertertries to be helpful, but just causes breakage
Date: Tue, December 11, 2007 12:26
From: "Alan Burlison (JIRA)" <[EMAIL PROTECTED]>

>     [ http://mc4j.org/jira/browse/STS-443?page=comments#action_10989 ]
>
> Alan Burlison commented on STS-443:
> -----------------------------------
>
> No it isn't.  That's talking about preprocessing of the *input* string,
not the
> *format* string.  Please see the initial comment.
>
> > Stripes DateTypeConverter tries to be helpful, but just causes breakage
> > -----------------------------------------------------------------------
> >
> >                 Key: STS-443
> >                 URL: http://mc4j.org/jira/browse/STS-443
> >             Project: Stripes
> >          Issue Type: Bug
> >          Components: Validation
> >    Affects Versions: Release 1.5, Release 1.4.3
> >         Environment: Solaris
> >            Reporter: Alan Burlison
> >         Assigned To: Tim Fennell
> >
> > DateTypeConverter tries to be helpful by inserting the locale-specific
converters
> into the list of validators which are tried in turn to convert a string
into a
> valid date, this is from getDateFormats():
> >         // Put the default localized dateformats in the aggregated array
> >         for (int i=0; i<defaultLocalizedFormats.length; i++) {
> >             dateFormats[i] = defaultLocalizedFormats[i];
> >             dateFormats[i].setLenient(false);
> >         }
> > The problem is when these formats conflict with the ones the user has
added by
> overriding getFormatStrings().  For example if I add "dd MM yyyy" to the
front of
> the list returned by getFormatStrings() and the locale is US, the code in
> getDateFormats() sticks "M d yy" before it in the format list, so dates
such as
> "01/02/2007" get silently misconverted - no errors, no warnings but the
date
> values returned are wrong.
> > See also STS-441
> > The whole date validation mechanism in Stripes is fragile and prone to
apparently
> inexplicable side-effects, and desperately needs rework.
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
> http://mc4j.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Stripes-development mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-development
>
>

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to