ICU-7019 Manually merge followin fixes for ICU4J 4.2.1; #6918(r26000, r26004, r26024), #6979(r26141), #7008(r26154), #7014(r26145), #7017(r26155) and tzdata2009j(r26165). icudata.jar/testdata.jar were built by icu4j maint-4-2@26166.

X-SVN-Rev: 26167
This commit is contained in:
Yoshito Umaoka 2009-06-25 05:28:32 +00:00
parent 01ec786cf8
commit 48cf844730
10 changed files with 41 additions and 21 deletions

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dd751b158829ed6eeb388f5c52590f6f79d83d8fb50a29f0fcfe47af393abb8a
size 774992
oid sha256:72f269af750451210b02d53a01e31b492f868ca8f413bc42cf75da0f34d65c21
size 772026

View file

@ -493,7 +493,7 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
// test locale without currency information
{"ti_ET", "-1.23", "USD", "-US$1.23", "-USD1.23", "-1.23 USD"},
// test choice format
{"es_AR", "1", "INR", "\u20a8\u00A01,00", "INR\u00A01,00", "1,00 rupia india"},
{"es_AR", "1", "INR", "Rs\u00A01,00", "INR\u00A01,00", "1,00 rupia india"},
{"ar_EG", "1", "USD", "US$\u00A0\u0661\u066B\u0660\u0660", "USD\u00a0\u0661\u066b\u0660\u0660", "\u0661\u066b\u0660\u0660 \u062f\u0648\u0644\u0627\u0631 \u0623\u0645\u0631\u064a\u0643\u064a"},
};
@ -1145,11 +1145,11 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
DecimalFormatSymbols US = new DecimalFormatSymbols(Locale.US);
DecimalFormat df = new DecimalFormat("'*&'' '\u00A4' ''&*' #,##0.00", US);
df.setCurrency(Currency.getInstance("INR"));
expect2(df, 1.0, "*&' \u20a8 '&* 1.00");
expect2(df, -2.0, "-*&' \u20a8 '&* 2.00");
expect2(df, 1.0, "*&' Rs '&* 1.00");
expect2(df, -2.0, "-*&' Rs '&* 2.00");
df.applyPattern("#,##0.00 '*&'' '\u00A4' ''&*'");
expect2(df, 2.0, "2.00 *&' \u20a8 '&*");
expect2(df, -1.0, "-1.00 *&' \u20a8 '&*");
expect2(df, 2.0, "2.00 *&' Rs '&*");
expect2(df, -1.0, "-1.00 *&' Rs '&*");
//#if defined(FOUNDATION10)
//## com.ibm.icu.math.BigDecimal r = df.getRoundingIncrement();

View file

@ -79,9 +79,9 @@ fpc: - 1234.56/JPY "¥1,235" 1235/JPY
# fpc: - 123/QQQ "QQQ123.00" 123/QQQ # QQQ is fake
fpc: - 123/GTQ "GTQ123.00" 123/GTQ
# ChoiceFormat-based display names
fpc: - 1/INR "1.00" 1/INR
fpc: - 1/INR "Rs1.00" 1/INR
fpc: - 2/INR "2.00" 2/INR
fpc: - 2/INR "Rs2.00" 2/INR
# Display names with shared prefix (YDD vs. Y)
fpc: - 100/YDD "YDD100.00" 100/YDD
fpc: - 100/CNY "CN¥100.00" 100/CNY

View file

@ -2089,7 +2089,7 @@ public class FormatTests
DateNumberFormat[] dnfmts = new DateNumberFormat[locales.length];
for (int i = 0; i < locales.length; i++) {
ULocale uloc = ULocale.forLocale(locales[i]);
dnfmts[i] = new DateNumberFormat(uloc);
dnfmts[i] = new DateNumberFormat(uloc,'0');
}
return dnfmts;
}

View file

@ -436,6 +436,10 @@ public class TimeZoneRuleTest extends TestFmwk {
String[] tzids = getTestZIDs();
for (int i = 0; i < tzids.length; i++) {
if (skipIfBeforeICU(4, 3, 1) && tzids[i].equals("Asia/Amman")) {
// See #7008
return;
}
BasicTimeZone olsontz = (BasicTimeZone)TimeZone.getTimeZone(tzids[i], TimeZone.TIMEZONE_ICU);
VTimeZone vtz_org = VTimeZone.create(tzids[i]);
vtz_org.setTZURL("http://source.icu-project.org/timezone");
@ -510,6 +514,10 @@ public class TimeZoneRuleTest extends TestFmwk {
for (int n = 0; n < startTimes.length; n++) {
long startTime = startTimes[n];
for (int i = 0; i < tzids.length; i++) {
if (skipIfBeforeICU(4, 3, 1) && tzids[i].equals("Asia/Amman")) {
// See #7008
return;
}
BasicTimeZone olsontz = (BasicTimeZone)TimeZone.getTimeZone(tzids[i], TimeZone.TIMEZONE_ICU);
VTimeZone vtz_org = VTimeZone.create(tzids[i]);
VTimeZone vtz_new = null;

View file

@ -38,8 +38,8 @@ public final class DateNumberFormat extends NumberFormat {
private int maxIntDigits;
private int minIntDigits;
public DateNumberFormat(ULocale loc) {
initialize(loc);
public DateNumberFormat(ULocale loc, char zeroDigitIn) {
initialize(loc,zeroDigitIn);
}
/* public DateNumberFormat(char zeroDigit, char minusSign) {
@ -48,14 +48,14 @@ public final class DateNumberFormat extends NumberFormat {
}
*/
private void initialize(ULocale loc) {
private void initialize(ULocale loc,char zeroDigitIn) {
char[] elems = (char[])CACHE.get(loc);
if (elems == null) {
// Missed cache
ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, loc);
String[] numberElements = rb.getStringArray("NumberElements");
elems = new char[2];
elems[0] = numberElements[4].charAt(0);
elems[0] = zeroDigitIn;
elems[1] = numberElements[6].charAt(0);
CACHE.put(loc, elems);
}

View file

@ -218,8 +218,14 @@ public class OlsonTimeZone extends BasicTimeZone {
// set DST saving amount and start year
stz.setDSTSavings(sav);
} else {
// We should not get here...
bDst = false;
// This could only happen if last rule is DST
// and the rule used forever. For example, Asia/Dhaka
// in tzdata2009i stays in DST forever.
// Hack - set DST starting at midnight on Jan 1st,
// ending 23:59:59.999 on Dec 31st
stz.setStartRule(0, 1, 0);
stz.setEndRule(11, 31, Grego.MILLIS_PER_DAY - 1);
}
}

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa8091988f86a0c01821d4d5ec5e50504f1e92353fcc2ce2f230ea42b2d83d4f
size 7214747
oid sha256:1a7fc3774da95dbb8982e4426beac90b79e4a33b79cde4415fb2c78fd54d8021
size 7212901

View file

@ -508,8 +508,14 @@ public class SimpleDateFormat extends DateFormat {
calendar = Calendar.getInstance(locale);
}
if (numberFormat == null) {
// Use a NumberFormat optimized for date formatting
numberFormat = new DateNumberFormat(locale);
NumberingSystem ns = NumberingSystem.getInstance(locale);
if ( ns.isAlgorithmic() ) {
numberFormat = NumberFormat.getInstance(locale);
} else {
char digit0 = ns.getDescription().charAt(0);
// Use a NumberFormat optimized for date formatting
numberFormat = new DateNumberFormat(locale, digit0);
}
}
// Note: deferring calendar calculation until when we really need it.
// Instead, we just record time of construction for backward compatibility.

View file

@ -989,7 +989,7 @@ public class SimpleTimeZone extends BasicTimeZone {
if (startMonth < Calendar.JANUARY || startMonth > Calendar.DECEMBER) {
throw new IllegalArgumentException();
}
if (startTime < 0 || startTime >= Grego.MILLIS_PER_DAY ||
if (startTime < 0 || startTime > Grego.MILLIS_PER_DAY ||
startTimeMode < WALL_TIME || startTimeMode > UTC_TIME) {
throw new IllegalArgumentException();
}