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;
}
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:
}
} 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:
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()) {
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) ) {
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);