From 94d1181171e0c189d04a5e61a0589532d2045858 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Wed, 2 Oct 2013 10:56:42 -0700 Subject: [PATCH] Ticket #54 - locale "nl" not supported by collation plugin 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. --- ldap/servers/plugins/collation/collate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ldap/servers/plugins/collation/collate.c b/ldap/servers/plugins/collation/collate.c index 2a73ee1..a02040f 100644 --- a/ldap/servers/plugins/collation/collate.c +++ b/ldap/servers/plugins/collation/collate.c @@ -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); -- 1.8.1.4