[opencms-dev] Bug if locales of the form "lc_CC" is used
Carsten Wilhelm
wilhelm at bplusd.de
Tue Apr 10 11:31:08 CEST 2012
Hi,
Sorry - has nobody a similar problem? I found a lot of calls to the constructor "new Locale(locale)" which is incorrect if you are using locales containing country and maybe variant.
I found a correct working solution in CmsLocaleManager.getLocale(locale), which checks for underscores and calls the Java Locale constructor accordingly.
>From my point of view, all occurrences of the standard constructor (where user defined locales are used) need to be replaced by a call to the static method above.
Can anybody confirm this? Maybe I will patch the 8.0.3 code and try this out in our installation.
Kind regads,
Carsten
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Carsten Wilhelm
Gesendet: Mittwoch, 4. April 2012 12:20
An: opencms-dev at opencms.org
Betreff: [opencms-dev] Bug if locales of the form "lc_CC" is used
Hi,
Just found a potentially bug in 8.0.3.
We've changed to the locale "de_DE", which is displayed correctly in the XML-Content-Editors Dropdowns in the Explorer view. All content is displayed correctly on the website and can be edited using ADE normally.
Adding existing content using the "New" wizard, checking the content type and drag the existing element to the page is working, too.
Creating new content by dragging the content type to the webpage results in an error message: "Language de_DE already exists in xml document" (I get the german error message, so the english one might vary a little bit).
Debugging using Eclipse and source distribution leads to this line in CmsContainerpageService.java:
Locale locale = new Locale(localeName);
Which fails if a locale containing a "_" is used. Unfortunately the java.util.Locale Class doesn't look after Underscores and puts "de_DE" in the language name. Afterwards, this seems to lead to confusion within the OpenCms. If I add a breakpoint here and change the value manually in Eclipse to "new Locale("de", "DE")" I can add the contant and from there on content addition is working for every other page. After restarting Tomcat I get the error again if I add new content.
So - should the new Locale() part be exchanged to something similar to what the CmsLocaleManager is doing? Or am I doing something completely wrong?
Kind regards,
Carsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120410/da5598da/attachment.htm>
More information about the opencms-dev
mailing list