lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-4021) Locale representations don't round trip from toString->new Locale.
Date Wed, 25 Apr 2012 22:26:18 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-4021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262201#comment-13262201
] 

Dawid Weiss commented on LUCENE-4021:
-------------------------------------

Heavy reflection or test ivy dependency on beanshell or some other simple scripting language...
then you'd just write different snippets of code for different JVMs and execute them as scripts.
This is a heavy beast for this but...
                
> Locale representations don't round trip from toString->new Locale.
> ------------------------------------------------------------------
>
>                 Key: LUCENE-4021
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4021
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Dawid Weiss
>            Priority: Minor
>
> The script and extensions are not currently parsed. Seems like they were added in 1.7
only too so it'll probably require Java-version-specific workarounds. 
> {noformat}
>   public void testLocaleRoundTrip() {
>     for (Locale locale : Locale.getAvailableLocales()) {
>       String s = locale.toString();
>       try {
>         Locale back = LuceneTestCase.localeForName(s);
>         assertEquals(locale, back);
>       } catch (Exception e) {
>         System.err.println("Failed roundtrip: " + s + " (" + e.toString() + ")");
>       } catch (AssertionError e) {
>         System.err.println("Not equals: " + s + " (" + e.toString() + ")");
>       }
>     }
>   }
> {noformat}
> Example locales that don't pass.
> {noformat}
> th_TH_TH_#u-nu-thai
> ja_JP_JP_#u-ca-japanese
> {noformat}
> Interestingly, some that do pass the reverse trip are not .equal to their originals:
> {noformat}
> Not equals: sr_ME_#Latn (java.lang.AssertionError: expected: java.util.Locale<sr_ME_#Latn>
but was: java.util.Locale<sr_ME_#Latn>)
> Not equals: sr_BA_#Latn (java.lang.AssertionError: expected: java.util.Locale<sr_BA_#Latn>
but was: java.util.Locale<sr_BA_#Latn>)
> Not equals: sr__#Latn (java.lang.AssertionError: expected: java.util.Locale<sr__#Latn>
but was: java.util.Locale<sr__#Latn>)
> Not equals: sr_RS_#Latn (java.lang.AssertionError: expected: java.util.Locale<sr_RS_#Latn>
but was: java.util.Locale<sr_RS_#Latn>)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message