mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-7623 Merged the fix for #7595 (r27899) from trunk to maint-4-4 for ICU 4.4.1.
X-SVN-Rev: 27957
This commit is contained in:
parent
b4b77fb3d8
commit
77d8285400
2 changed files with 34 additions and 4 deletions
|
@ -1605,11 +1605,17 @@ public class SimpleDateFormat extends DateFormat {
|
|||
index--;
|
||||
}
|
||||
int padding = minDigits - (limit - index);
|
||||
for (; padding > 0; padding--) {
|
||||
while (padding > 0 && index > 0) {
|
||||
decimalBuf[--index] = zeroDigit;
|
||||
padding--;
|
||||
}
|
||||
int length = limit - index;
|
||||
buf.append(decimalBuf, index, length);
|
||||
while (padding > 0) {
|
||||
// when pattern width is longer than decimalBuf, need extra
|
||||
// leading zeros - ticke#7595
|
||||
buf.append(zeroDigit);
|
||||
padding--;
|
||||
}
|
||||
buf.append(decimalBuf, index, limit - index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3676,5 +3676,29 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
|||
errln("DateFormat.getPatternInstance is not suppose to return an exception.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test case for very long numeric field patterns (ticket#7595)
|
||||
*/
|
||||
public void TestLongNumericPattern() {
|
||||
String DATA[] = {
|
||||
"yyyy MM dd",
|
||||
|
||||
"yyyy.MM.dd", "fp", "2010 04 01",
|
||||
"2010.04.01", "2010 04 01",
|
||||
|
||||
"yyyyyyyyyy.MM.dd", "fp", "2010 04 01",
|
||||
"0000002010.04.01", "2010 04 01",
|
||||
|
||||
"yyyyyyyyyyy.MM.dd", "fp", "2010 04 01",
|
||||
"00000002010.04.01", "2010 04 01",
|
||||
|
||||
"yyyyyyyyyyy.M.dddddddddd", "fp", "2010 04 01",
|
||||
"00000002010.4.0000000001", "2010 04 01",
|
||||
|
||||
"y.M.ddddddddddd", "fp", "2010 10 11",
|
||||
"2010.10.00000000011", "2010 10 11",
|
||||
};
|
||||
expect(DATA, new Locale("en", "", ""));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue