8051641: Africa/Casablanca transitions is incorrectly calculated starting from 2027
authoraefimov
Tue, 16 Dec 2014 23:59:57 +0300
changeset 28094 d0383a8fa398
parent 28093 270b6925cbc8
child 28107 587cd87d5c98
8051641: Africa/Casablanca transitions is incorrectly calculated starting from 2027 Reviewed-by: sherman
jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
jdk/test/ProblemList.txt
jdk/test/sun/util/calendar/zi/Rule.java
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Tue Dec 16 12:48:31 2014 -0800
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Tue Dec 16 23:59:57 2014 +0300
@@ -758,8 +758,8 @@
                         if (endYear == Year.MAX_VALUE) {
                             endYear = startYear;
                             lastRules.add(new TransRule(endYear, rule));
-                            lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
                         }
+                        lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
                     } else {
                         if (endYear == Year.MAX_VALUE) {
                             //endYear = zoneEnd.getYear();
--- a/jdk/test/ProblemList.txt	Tue Dec 16 12:48:31 2014 -0800
+++ b/jdk/test/ProblemList.txt	Tue Dec 16 23:59:57 2014 +0300
@@ -303,9 +303,6 @@
 
 # jdk_util
 
-# 8051641
-sun/util/calendar/zi/TestZoneInfo310.java                        generic-all
-
 # 8062512
 java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
 
--- a/jdk/test/sun/util/calendar/zi/Rule.java	Tue Dec 16 12:48:31 2014 -0800
+++ b/jdk/test/sun/util/calendar/zi/Rule.java	Tue Dec 16 23:59:57 2014 +0300
@@ -126,6 +126,14 @@
             });
         rules.clear();
         for (int i = 0; i < n; i++) {
+            if (i != 0 && recs[i -1].getSave() == recs[i].getSave()) {
+                // we have two recs back to back with same saving for the same year.
+                if (recs[i].isLastRule()) {
+                    continue;
+                } else if (recs[i - 1].isLastRule()) {
+                    rules.remove(rules.size() - 1);
+                }
+            }
             rules.add(recs[i]);
         }
         return rules;