PluginConfigTest in CMS project failing under locale nl_NL

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PluginConfigTest in CMS project failing under locale nl_NL

Wouter Danes-2

Hi guys,

 

I was fiddling around on my home pc with the CMS and I ran into a nasty issue.

If I try to build the CMS project the PluginConfigTest fails on the test “testWrappedSerialization”.

Further inspection shows that the value “3.0” is read from the “String property”  and then converted to Double.
This is where it goes wrong. When it reads a String value, it uses the system default locale to convert the String to a Double.

In the nl_NL locale, the decimal separator is ‘,’ instead of ‘.’, so the conversion ignores the dot and sees the value as 30, instead of 3.0.

I fixed the test by doing a Locale.setDefault(Locale.US), but this raises the question: can Hippo CMS only run on a server which has the locale set to en_US?

 

Regards,

 

Wouter


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: PluginConfigTest in CMS project failing under locale nl_NL

Unico Hommes
Doesn't this just mean that when you run on a server with default
locale Dutch and you want to configure a double in a string property
that you then need to use a comma instead of a point? AFAIK we don't
have any such configurations in the CMS and I think it would be a very
rare occurrence for a project. If they do, then they should simply use
a Double type property. So on the basis of this issue I would not
conclude Hippo CMS does not run on such a system.

But it is an interesting point to raise. There might be other issues
that prevent the cms from working properly on a different default
locale. I'm pretty sure this isn't in our test plans and doubt it is
mentioned in any official availability matrix.

--
Unico

On Wed, Dec 12, 2012 at 11:18 PM, Wouter Danes
<[hidden email]> wrote:

> Hi guys,
>
>
>
> I was fiddling around on my home pc with the CMS and I ran into a nasty
> issue.
>
> If I try to build the CMS project the PluginConfigTest fails on the test
> “testWrappedSerialization”.
>
> Further inspection shows that the value “3.0” is read from the “String
> property”  and then converted to Double.
> This is where it goes wrong. When it reads a String value, it uses the
> system default locale to convert the String to a Double.
>
> In the nl_NL locale, the decimal separator is ‘,’ instead of ‘.’, so the
> conversion ignores the dot and sees the value as 30, instead of 3.0.
>
> I fixed the test by doing a Locale.setDefault(Locale.US), but this raises
> the question: can Hippo CMS only run on a server which has the locale set to
> en_US?
>
>
>
> Regards,
>
>
>
> Wouter
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: PluginConfigTest in CMS project failing under locale nl_NL

Wouter Danes-2
It was on my Windows box, which I rarely use for development, but I just ran into it so I figured I'd raise a flag. :)
This was in IntelliJ IDEA under windows with a default locale of nl_NL, yes.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Unico Hommes
Sent: donderdag 13 december 2012 8:22
To: Hippo CMS 7 implementation list
Subject: Re: [Hippo-cms7-user] PluginConfigTest in CMS project failing under locale nl_NL

Doesn't this just mean that when you run on a server with default locale Dutch and you want to configure a double in a string property that you then need to use a comma instead of a point? AFAIK we don't have any such configurations in the CMS and I think it would be a very rare occurrence for a project. If they do, then they should simply use a Double type property. So on the basis of this issue I would not conclude Hippo CMS does not run on such a system.

But it is an interesting point to raise. There might be other issues that prevent the cms from working properly on a different default locale. I'm pretty sure this isn't in our test plans and doubt it is mentioned in any official availability matrix.

--
Unico

On Wed, Dec 12, 2012 at 11:18 PM, Wouter Danes <[hidden email]> wrote:

> Hi guys,
>
>
>
> I was fiddling around on my home pc with the CMS and I ran into a
> nasty issue.
>
> If I try to build the CMS project the PluginConfigTest fails on the
> test "testWrappedSerialization".
>
> Further inspection shows that the value "3.0" is read from the "String
> property"  and then converted to Double.
> This is where it goes wrong. When it reads a String value, it uses the
> system default locale to convert the String to a Double.
>
> In the nl_NL locale, the decimal separator is ',' instead of '.', so
> the conversion ignores the dot and sees the value as 30, instead of 3.0.
>
> I fixed the test by doing a Locale.setDefault(Locale.US), but this
> raises the question: can Hippo CMS only run on a server which has the
> locale set to en_US?
>
>
>
> Regards,
>
>
>
> Wouter
>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: PluginConfigTest in CMS project failing under locale nl_NL

Frank van Lankvelt
As Unico remarks, if the plugin configuration needs to return a
double, the value should indeed be stored as a double.

The problem appears to be in the test itself.  The value is written as
a string, so localization is indeed not handled correctly.
Perhaps the build() method in the RepositoryTestCase can be modified
to handle doubles, integers, etcetera instead of just strings.
(it would have to change signature though)

cheers, Frank

On Thu, Dec 13, 2012 at 10:12 AM, Wouter Danes
<[hidden email]> wrote:

> It was on my Windows box, which I rarely use for development, but I just ran into it so I figured I'd raise a flag. :)
> This was in IntelliJ IDEA under windows with a default locale of nl_NL, yes.
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Unico Hommes
> Sent: donderdag 13 december 2012 8:22
> To: Hippo CMS 7 implementation list
> Subject: Re: [Hippo-cms7-user] PluginConfigTest in CMS project failing under locale nl_NL
>
> Doesn't this just mean that when you run on a server with default locale Dutch and you want to configure a double in a string property that you then need to use a comma instead of a point? AFAIK we don't have any such configurations in the CMS and I think it would be a very rare occurrence for a project. If they do, then they should simply use a Double type property. So on the basis of this issue I would not conclude Hippo CMS does not run on such a system.
>
> But it is an interesting point to raise. There might be other issues that prevent the cms from working properly on a different default locale. I'm pretty sure this isn't in our test plans and doubt it is mentioned in any official availability matrix.
>
> --
> Unico
>
> On Wed, Dec 12, 2012 at 11:18 PM, Wouter Danes <[hidden email]> wrote:
>> Hi guys,
>>
>>
>>
>> I was fiddling around on my home pc with the CMS and I ran into a
>> nasty issue.
>>
>> If I try to build the CMS project the PluginConfigTest fails on the
>> test "testWrappedSerialization".
>>
>> Further inspection shows that the value "3.0" is read from the "String
>> property"  and then converted to Double.
>> This is where it goes wrong. When it reads a String value, it uses the
>> system default locale to convert the String to a Double.
>>
>> In the nl_NL locale, the decimal separator is ',' instead of '.', so
>> the conversion ignores the dot and sees the value as 30, instead of 3.0.
>>
>> I fixed the test by doing a Locale.setDefault(Locale.US), but this
>> raises the question: can Hippo CMS only run on a server which has the
>> locale set to en_US?
>>
>>
>>
>> Regards,
>>
>>
>>
>> Wouter
>>
>>
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html