diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index c3bee8f0f0..45705f8186 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -1900,26 +1900,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition& int32_t s = subParse(text, pos, ch, count, FALSE, TRUE, ambiguousYear, saveHebrewMonth, *workCal, i); - if (s == -pos-1) { - // era not present, in special cases allow this to continue - s++; - - if (i+1 < fPattern.length()) { - // move to next pattern character - UChar ch = fPattern.charAt(i+1); - - // check for whitespace - if (uprv_isRuleWhiteSpace(ch)) { - i++; - // Advance over run in pattern - while ((i+1)fEraNames, fSymbols->fEraNamesCount, cal); } - ps = matchString(text, start, UCAL_ERA, fSymbols->fEras, fSymbols->fErasCount, cal); - if (ps == -start) - ps--; - return ps; + return matchString(text, start, UCAL_ERA, fSymbols->fEras, fSymbols->fErasCount, cal); case UDAT_YEAR_FIELD: // If there are 3 or more YEAR pattern characters, this indicates diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp index 23bc77ad1b..e179b80258 100644 --- a/icu4c/source/test/intltest/dtfmttst.cpp +++ b/icu4c/source/test/intltest/dtfmttst.cpp @@ -79,10 +79,9 @@ void DateFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &nam TESTCASE(39,Test6726); TESTCASE(40,TestGMTParsing); TESTCASE(41,Test6880); - TESTCASE(42,Test4917); /* - TESTCASE(43,TestRelativeError); - TESTCASE(44,TestRelativeOther); + TESTCASE(42,TestRelativeError); + TESTCASE(43,TestRelativeOther); */ default: name = ""; break; } @@ -3343,50 +3342,6 @@ void DateFormatTest::Test6880() { delete fmt; } -void DateFormatTest::Test4917() { - - const char* data[] = { - // input, output - "BC 4004-10-23T07:00:00Z", "BC 4004-10-23T07:00:00Z", - "AD 4004-10-23T07:00:00Z", "AD 4004-10-23T07:00:00Z", - "-4004-10-23T07:00:00Z" , "BC 4005-10-23T07:00:00Z", - "4004-10-23T07:00:00Z" , "AD 4004-10-23T07:00:00Z", - }; - - int32_t numData = 8; - - UErrorCode status = U_ZERO_ERROR; - - // create formatter - SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("GGG yyyy-MM-dd'T'HH:mm:ss'Z"), status); - failure(status, "new SimpleDateFormat"); - - for(int i=0; i < numData; i+=2) { - - // create input string - UnicodeString in = data[i]; - - // parse string to date - UDate dt1 = fmt1->parse(in, status); - failure(status, "fmt->parse"); - - // format date back to string - UnicodeString out; - out = fmt1->format(dt1, out); - logln(out); - - // check that roundtrip worked as expected - UnicodeString expected = data[i+1]; - if (out != expected) { - errln((UnicodeString)"FAIL: " + in + " -> " + out + " expected -> " + expected); - } - - } - - delete fmt1; - -} - #endif /* #if !UCONFIG_NO_FORMATTING */ //eof diff --git a/icu4c/source/test/intltest/dtfmttst.h b/icu4c/source/test/intltest/dtfmttst.h index 3b7dce7962..87226fe8d8 100644 --- a/icu4c/source/test/intltest/dtfmttst.h +++ b/icu4c/source/test/intltest/dtfmttst.h @@ -167,7 +167,6 @@ public: // package void Test6880(void); - void Test4917(void); public: /** * Test host-specific formatting.