You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/03/19 22:30:43 UTC
[jira] [Created] (SOLR-5885)
solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
has crazy locale lookup
Uwe Schindler created SOLR-5885:
-----------------------------------
Summary: 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
Fix For: 4.8, 5.0
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
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org