You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Alexandre Rafalovitch (Jira)" <ji...@apache.org> on 2020/08/29 20:28:00 UTC

[jira] [Resolved] (SOLR-5885) solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java has crazy locale lookup

     [ https://issues.apache.org/jira/browse/SOLR-5885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexandre Rafalovitch resolved SOLR-5885.
-----------------------------------------
    Resolution: Won't Fix

> solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java has crazy locale lookup
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-5885
>                 URL: https://issues.apache.org/jira/browse/SOLR-5885
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.7
>            Reporter: Uwe Schindler
>            Priority: Major
>             Fix For: 6.0, 4.9
>
>
> SimplePropertiesWriter uses the following code to convert a string to a java.util.Locale:
> {code:java}
>     if(params.get(LOCALE) != null) {
>       String localeStr = params.get(LOCALE);
>       for (Locale l : Locale.getAvailableLocales()) {
>         if(localeStr.equals(l.getDisplayName(Locale.ROOT))) {
>           locale = l;
>           break;
>         }
>       }
>       if(locale==null) {
>         throw new DataImportHandlerException(SEVERE, "Unsupported locale for PropertWriter: " + localeStr);
>       }
>     } else {
>       locale = Locale.ROOT;
>     }    
> {code}
> This makes no sense to me. Before I fixed that in LUCENE-5540, it was using the "localized" display name of the locale for lookup.
> As we are on Java 7 in trunk and 4.x we can use the new API: {{Locale#forLanguageTag(String languageTag)}}
> This one is not dependent on current locale, does not use display name and follows standards (IETF BCP 47).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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