ICU-6216 Fix a test data problem. Also made a minor change to keep the J code synchronized with C.
X-SVN-Rev: 23781
This commit is contained in:
parent
a55d75d400
commit
2f93b164db
@ -1288,7 +1288,7 @@ public class TimeZoneRuleTest extends TestFmwk {
|
||||
"PRODID:-//PYVOBJECT//NONSGML Version 1//EN\r\n" +
|
||||
"BEGIN:VTIMEZONE\r\n" +
|
||||
"TZID:Asia/Tokyo\r\n" +
|
||||
"BEGIN:STANDARD\n" +
|
||||
"BEGIN:STANDARD\r\n" +
|
||||
"DTSTART:20000101T000000\r\n" +
|
||||
"RRULE:FREQ=YEARLY;BYMONTH=1\r\n" +
|
||||
"TZNAME:Asia/Tokyo\r\n" +
|
||||
|
@ -770,53 +770,51 @@ public class VTimeZone extends BasicTimeZone {
|
||||
// Only one final rule, only governs the initial rule,
|
||||
// which is already initialized, thus, we do not need to
|
||||
// add this transition rule
|
||||
tz = rbtz;
|
||||
setID(tzid);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Normalize the final rule
|
||||
AnnualTimeZoneRule finalRule = (AnnualTimeZoneRule)rules.get(finalRuleIdx);
|
||||
int tmpRaw = finalRule.getRawOffset();
|
||||
int tmpDST = finalRule.getDSTSavings();
|
||||
|
||||
// Find the last non-final rule
|
||||
Date finalStart = finalRule.getFirstStart(initialRawOffset, initialDSTSavings);
|
||||
Date start = finalStart;
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
if (finalRuleIdx == i) {
|
||||
continue;
|
||||
}
|
||||
TimeZoneRule r = (TimeZoneRule)rules.get(i);
|
||||
Date lastStart = r.getFinalStart(tmpRaw, tmpDST);
|
||||
if (lastStart.after(start)) {
|
||||
start = finalRule.getNextStart(lastStart.getTime(),
|
||||
r.getRawOffset(),
|
||||
r.getDSTSavings(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
TimeZoneRule newRule;
|
||||
if (start == finalStart) {
|
||||
// Transform this into a single transition
|
||||
newRule = new TimeArrayTimeZoneRule(
|
||||
finalRule.getName(),
|
||||
finalRule.getRawOffset(),
|
||||
finalRule.getDSTSavings(),
|
||||
new long[] {finalStart.getTime()},
|
||||
DateTimeRule.UTC_TIME);
|
||||
rules.clear();
|
||||
} else {
|
||||
// Update the end year
|
||||
int fields[] = Grego.timeToFields(start.getTime(), null);
|
||||
newRule = new AnnualTimeZoneRule(
|
||||
finalRule.getName(),
|
||||
finalRule.getRawOffset(),
|
||||
finalRule.getDSTSavings(),
|
||||
finalRule.getRule(),
|
||||
finalRule.getStartYear(),
|
||||
fields[0]);
|
||||
// Normalize the final rule
|
||||
AnnualTimeZoneRule finalRule = (AnnualTimeZoneRule)rules.get(finalRuleIdx);
|
||||
int tmpRaw = finalRule.getRawOffset();
|
||||
int tmpDST = finalRule.getDSTSavings();
|
||||
|
||||
// Find the last non-final rule
|
||||
Date finalStart = finalRule.getFirstStart(initialRawOffset, initialDSTSavings);
|
||||
Date start = finalStart;
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
if (finalRuleIdx == i) {
|
||||
continue;
|
||||
}
|
||||
TimeZoneRule r = (TimeZoneRule)rules.get(i);
|
||||
Date lastStart = r.getFinalStart(tmpRaw, tmpDST);
|
||||
if (lastStart.after(start)) {
|
||||
start = finalRule.getNextStart(lastStart.getTime(),
|
||||
r.getRawOffset(),
|
||||
r.getDSTSavings(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
TimeZoneRule newRule;
|
||||
if (start == finalStart) {
|
||||
// Transform this into a single transition
|
||||
newRule = new TimeArrayTimeZoneRule(
|
||||
finalRule.getName(),
|
||||
finalRule.getRawOffset(),
|
||||
finalRule.getDSTSavings(),
|
||||
new long[] {finalStart.getTime()},
|
||||
DateTimeRule.UTC_TIME);
|
||||
} else {
|
||||
// Update the end year
|
||||
int fields[] = Grego.timeToFields(start.getTime(), null);
|
||||
newRule = new AnnualTimeZoneRule(
|
||||
finalRule.getName(),
|
||||
finalRule.getRawOffset(),
|
||||
finalRule.getDSTSavings(),
|
||||
finalRule.getRule(),
|
||||
finalRule.getStartYear(),
|
||||
fields[0]);
|
||||
}
|
||||
rules.set(finalRuleIdx, newRule);
|
||||
}
|
||||
rules.set(finalRuleIdx, newRule);
|
||||
}
|
||||
|
||||
Iterator rit = rules.iterator();
|
||||
|
Loading…
Reference in New Issue
Block a user