mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-8716 Fix errors in cintltst and intltest when data is missing
X-SVN-Rev: 31552
This commit is contained in:
parent
670109a1aa
commit
76444a4b71
4 changed files with 20 additions and 2 deletions
|
@ -3341,7 +3341,9 @@ SimpleDateFormat::tzFormat() const {
|
|||
if (fTimeZoneFormat == NULL) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
TimeZoneFormat *tzfmt = TimeZoneFormat::createInstance(fLocale, status);
|
||||
U_ASSERT(U_SUCCESS(status));
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const_cast<SimpleDateFormat *>(this)->fTimeZoneFormat = tzfmt;
|
||||
}
|
||||
|
|
|
@ -1246,6 +1246,10 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
|
||||
if (style == GENERIC_LOCATION || style == LONG_GENERIC || style == SHORT_GENERIC) {
|
||||
LocalPointer<TimeZoneFormat> tzfmt(TimeZoneFormat::createInstance(locale, status));
|
||||
if (U_FAILURE(status)) {
|
||||
result.remove();
|
||||
return result;
|
||||
}
|
||||
// Generic format
|
||||
switch (style) {
|
||||
case GENERIC_LOCATION:
|
||||
|
@ -1269,6 +1273,10 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
}
|
||||
} else if (style == LONG_GMT || style == SHORT_GMT) {
|
||||
LocalPointer<TimeZoneFormat> tzfmt(TimeZoneFormat::createInstance(locale, status));
|
||||
if (U_FAILURE(status)) {
|
||||
result.remove();
|
||||
return result;
|
||||
}
|
||||
offset = daylight && useDaylightTime() ? getRawOffset() + getDSTSavings() : getRawOffset();
|
||||
switch (style) {
|
||||
case LONG_GMT:
|
||||
|
@ -1296,6 +1304,10 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
U_ASSERT(FALSE);
|
||||
}
|
||||
LocalPointer<TimeZoneNames> tznames(TimeZoneNames::createInstance(locale, status));
|
||||
if (U_FAILURE(status)) {
|
||||
result.remove();
|
||||
return result;
|
||||
}
|
||||
UnicodeString canonicalID(ZoneMeta::getCanonicalCLDRID(*this));
|
||||
tznames->getDisplayName(canonicalID, nameType, date, result);
|
||||
if (result.isEmpty()) {
|
||||
|
|
|
@ -1272,7 +1272,7 @@ static void TestContext(void) {
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UDateFormat* udfmt = udat_open(UDAT_NONE, UDAT_MEDIUM, textContextItemPtr->locale, NULL, 0, NULL, 0, &status);
|
||||
if ( U_FAILURE(status) ) {
|
||||
log_err("FAIL: udat_open for locale %s, status %s\n", textContextItemPtr->locale, u_errorName(status) );
|
||||
log_data_err("FAIL: udat_open for locale %s, status %s\n", textContextItemPtr->locale, u_errorName(status) );
|
||||
} else {
|
||||
UDateTimePatternGenerator* udtpg = udatpg_open(textContextItemPtr->locale, &status);
|
||||
if ( U_FAILURE(status) ) {
|
||||
|
|
|
@ -109,6 +109,10 @@ TimeZoneFormatTest::TestTimeZoneRoundTrip(void) {
|
|||
for (int32_t locidx = 0; locidx < nLocales; locidx++) {
|
||||
UnicodeString localGMTString;
|
||||
SimpleDateFormat gmtFmt(UnicodeString("ZZZZ"), LOCALES[locidx], status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("Error creating SimpleDateFormat - %s", u_errorName(status));
|
||||
continue;
|
||||
}
|
||||
gmtFmt.setTimeZone(*TimeZone::getGMT());
|
||||
gmtFmt.format(0.0, localGMTString);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue