commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [betwixt] TestObjectStringConverters failing on non US locale
Date Tue, 09 Sep 2003 23:07:12 GMT
On Tuesday, September 9, 2003, at 03:50 PM, Christoph Sturm wrote:

> Hi All!

hi Christoph

> I get this junit failure with the cvs version:
> junit.framework.ComparisonFailure: String output same as 
> java.util.Date.toString() (1)
> Expected:Tue Sep 09 16:22:58 CEST 2003
> Actual  :Di Sep 09 16:22:58 CEST 2003

thanks for the spot. this is a bug.

i've committed a fix and (as importantly) a new unit test that runs under 
a non-english default locale.

> it seems that the Date.toString function doesnt account for locales, 
> while SimpleDateFormat does. I dont know why its neccesary that the 
> output is the same as the toString output, and I'm not sure whats the 
> best solution, but I think the converter should return non-localized 
> names, to make it easier to import on other locales. Does anyone with 
> more betwixt expierence then me have an opinion on that?

let me explain. there is a school of thought that says that comprehensive 
support for dates is not really possible without the user configuration. i 
(and some other betwixters) are inclined towards this view.

but many users want basis date round-tripping supported out-of-the-box. 
backwards compatibility concerns (for writing) mean that Date.toString() 
is the only real choice for this. that's why Date.toString() compatibility 
was chosen :)

FWIW there are a lot of features that need to be added to betwixt. one of 
those is localization. i have thought a little about this and the way that 
i'd probably go about this would be to support a Locale property of the 
Context. this would default to the current locale but could also be set 
programmatically. then locale-aware converters could localize the 
object <-> string conversion. i haven't really thought deeply about this 
so this would probably be a good time to try to influence this support...

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message