ICU-4068 Fix warning code for non-existent language

X-SVN-Rev: 16545
This commit is contained in:
Deborah Goldsmith 2004-10-18 23:58:03 +00:00
parent b24fbf87f0
commit 9cc484fdb3
2 changed files with 16 additions and 1 deletions

View File

@ -33,8 +33,15 @@ ulocdata_getExemplarSet(USet *fillIn, const char *localeID,
}
bundle = ures_open(NULL, localeID, status);
if (U_FAILURE(*status)) {
return NULL;
}
exemplarChars = ures_getStringByKey(bundle, EXEMPLAR_CHARS, &len, status);
UErrorCode localStatus = U_ZERO_ERROR;
exemplarChars = ures_getStringByKey(bundle, EXEMPLAR_CHARS, &len, &localStatus);
if (U_FAILURE(localStatus) || (*status != U_USING_DEFAULT_WARNING && localStatus != U_ZERO_ERROR)) {
*status = localStatus;
}
if(fillIn != NULL){
uset_applyPattern(fillIn, exemplarChars, len,

View File

@ -1110,6 +1110,14 @@ static void TestExemplarSet(void){
assertTrue("case-folded is sometimes a strict superset, and sometimes equal",
equalCount > 0 && equalCount < n);
/* JB 4068 - Nonexistent language */
ec = U_ZERO_ERROR;
USet *nothing = ulocdata_getExemplarSet(NULL, "qqq", 0, &ec);
uset_close(nothing);
if (ec != U_USING_DEFAULT_WARNING) {
log_err("Exemplar set for \"qqq\", expecting U_USING_DEFAULT_WARNING, but got %s\n",
u_errorName(ec));
}
END:
uenum_close(avail);
uset_close(exemplarSets[0]);