Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8064914

tzdb.dat compilation failure when using tzdata2014j

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b42
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        The following error was observed during compilation of tzdb.dat with latest JDK9 source:
        Failed: java.time.zone.ZoneRulesException: Unknown time-zone ID: Africa/Asmera
        java.time.zone.ZoneRulesException: Unknown time-zone ID: Africa/Asmera
        at build.tools.tzdb.TzdbZoneRulesProvider.getZoneRules(TzdbZoneRulesProvider.java:98)
        at build.tools.tzdb.TzdbZoneRulesCompiler.compile(TzdbZoneRulesCompiler.java:194)
        at build.tools.tzdb.TzdbZoneRulesCompiler.main(TzdbZoneRulesCompiler.java:89)

        The issue was observed during latest tzdata2014j integration (JDK-8064560).
        The issue is cause by the following timezone linking behavior:
        There is a Zone with name 'Africa/Nairobi' (defined in 'africa' tzdata file).
        The zone link with name 'Africa/Asmara' is defined in the same 'africa' file. This link refers to 'Africa/Nairobi'.
        And there is another link with name 'Africa/Asmera' defined in 'backward' tz file. It is linked to 'Africa/Asmara'.
        It means that 'Africa/Asmera' linked to 'Africa/Nairobi' through another link (double link chain).
        It seems that the current implementation of Tzdb compiler supports only direct links (link to the zone, but not to another link).

          Issue Links

            Activity

            Hide
            aefimov Aleksej Efimov added a comment - - edited
            The following fix solves the problem:
            diff -r a474ad2dbd9b make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
            --- a/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Fri Nov 14 11:41:42 2014 +0000
            +++ b/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Fri Nov 14 17:40:25 2014 +0300
            @@ -95,7 +95,17 @@
                             obj = zones.get(zoneId);
                         }
                         if (obj == null) {
            - throw new ZoneRulesException("Unknown time-zone ID: " + zoneId0);
            + // Timezone link can be located in 'backward' file and it
            + // can refer to another link, so we need to check for
            + // link one more time, before throwing an exception
            + String zoneIdBack = zoneId;
            + if (links.containsKey(zoneId)) {
            + zoneId = links.get(zoneId);
            + obj = zones.get(zoneId);
            + }
            + if (obj == null) {
            + throw new ZoneRulesException("Unknown time-zone ID: " + zoneIdBack);
            + }
                         }
                     }
                     if (obj instanceof ZoneRules) {
            Show
            aefimov Aleksej Efimov added a comment - - edited The following fix solves the problem: diff -r a474ad2dbd9b make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java --- a/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Fri Nov 14 11:41:42 2014 +0000 +++ b/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java Fri Nov 14 17:40:25 2014 +0300 @@ -95,7 +95,17 @@                  obj = zones.get(zoneId);              }              if (obj == null) { - throw new ZoneRulesException("Unknown time-zone ID: " + zoneId0); + // Timezone link can be located in 'backward' file and it + // can refer to another link, so we need to check for + // link one more time, before throwing an exception + String zoneIdBack = zoneId; + if (links.containsKey(zoneId)) { + zoneId = links.get(zoneId); + obj = zones.get(zoneId); + } + if (obj == null) { + throw new ZoneRulesException("Unknown time-zone ID: " + zoneIdBack); + }              }          }          if (obj instanceof ZoneRules) {
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/ec4e085f9f30
            User: aefimov
            Date: 2014-11-17 11:15:54 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/ec4e085f9f30 User: aefimov Date: 2014-11-17 11:15:54 +0000
            Hide
            coffeys Sean Coffey added a comment -
            whoops - looks like we forgot to remove the unused zoneId0 variable. We can keep this in mind next time we come to visit this code.
            "String zoneId0 = zoneId"
            Show
            coffeys Sean Coffey added a comment - whoops - looks like we forgot to remove the unused zoneId0 variable. We can keep this in mind next time we come to visit this code. "String zoneId0 = zoneId"
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/ec4e085f9f30
            User: lana
            Date: 2014-12-10 19:55:01 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/ec4e085f9f30 User: lana Date: 2014-12-10 19:55:01 +0000

              People

              • Assignee:
                aefimov Aleksej Efimov
                Reporter:
                aefimov Aleksej Efimov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: