Skip to content

Commit

Permalink
Ticket #54 - locale "nl" not supported by collation plugin
Browse files Browse the repository at this point in the history
Bug description: In the recent version of ICU, some locales do not
have its specific collator, but are included in the default (root)
locale.  "nl", "en", and "fr" are in the class.  ICU API ucol_open
takes the locale string and returns the collator with the status.
If the locale has no dedicated collator and the root collator is
picked up, status U_USING_DEFAULT_WARNING is returned, which is not
an error.  But collation_indexer_create (collate.c) treats it as an
error and stops the collation.

Fix description: As ICU doc suggests, error checking for ucol_open
is replaced with "(U_SUCCESS(err)", by which the status U_USING_
DEFAULT_WARNING is correctlly handled.

https://fedorahosted.org/389/ticket/54

Reviewed by rmeggins (Thank you, Rich!!)
  • Loading branch information
nhosoi committed Oct 2, 2013
1 parent 5862d6c commit c8d1cf5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ldap/servers/plugins/collation/collate.c
Expand Up @@ -449,20 +449,17 @@ collation_indexer_create (const char* oid)
* or if we found a fallback one, or if we are happy with
* the default, use it.
*/
if (err == U_ZERO_ERROR || err == U_USING_FALLBACK_WARNING ||
(err == U_USING_DEFAULT_WARNING && is_default)) {
if (U_SUCCESS(err)) {
etc = (collation_indexer_t*) slapi_ch_calloc (1, sizeof (collation_indexer_t));
ix = (indexer_t*) slapi_ch_calloc (1, sizeof (indexer_t));
ucol_setAttribute (coll, UCOL_STRENGTH, profile->strength, &err);
if (err != U_ZERO_ERROR && err != U_USING_FALLBACK_WARNING
&& (err != U_USING_DEFAULT_WARNING || !is_default)) {
if (U_FAILURE(err)) {
LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
"set the collator strength for oid %s to %d: err %d\n",
oid, profile->strength, err);
}
ucol_setAttribute (coll, UCOL_DECOMPOSITION_MODE, profile->decomposition, &err);
if (err != U_ZERO_ERROR && err != U_USING_FALLBACK_WARNING
&& (err != U_USING_DEFAULT_WARNING || !is_default)) {
if (U_FAILURE(err)) {
LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
"set the collator decomposition mode for oid %s to %d: err %d\n",
oid, profile->decomposition, err);
Expand Down

0 comments on commit c8d1cf5

Please sign in to comment.