Update to tzdata2019b is failing - tzupdater versi

2020-07-26 10:44发布

I'm trying to use Oracle's tzupdater tool for updating timezone data. I saw a stack overflow answer (Error updating tzdata 2018f (Released 2018-10-18) with tzupdater-2.2.0) saying the problem was fixed in a 2018 version of the timezone data, but it's now trying to install a 2019 version and is still failing.

# java -jar tzupdater.jar -v -l
Using https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz as source for tzdata bundle.
java.home: /usr/java/jre1.8.0_102
java.vendor: Oracle Corporation
java.version: 1.8.0_102
tzupdater version 2.2.0-b01
JRE tzdata version: tzdata2016d
Downloaded file to /tmp/tz.tmp_3/tzdata.tar.gz
tzupdater tool would update with tzdata version: tzdata2019b
Compiling TZDB version 2019b
Parsing file: /tmp/tz.tmp_3/africa
Parsing file: /tmp/tz.tmp_3/antarctica
Parsing file: /tmp/tz.tmp_3/asia
Failed: java.lang.Exception: Failed while parsing file '/tmp/tz.tmp_3/asia' on line 1865 'Rule  Japan   1948    1951    -   Sep Sat>=8  25:00   0   S'
java.lang.Exception: Failed while parsing file '/tmp/tz.tmp_3/asia' on line 1865 'Rule  Japan   1948    1951    -   Sep Sat>=825:00 0   S'
    at tools.tzdb.TzdbZoneRulesCompiler.parseFile(TzdbZoneRulesCompiler.java:377)
    at tools.tzdb.TzdbZoneRulesCompiler.compile(TzdbZoneRulesCompiler.java:191)
    at tools.tzdb.TzdbZoneRulesCompiler.<init>(TzdbZoneRulesCompiler.java:307)
    at com.sun.tools.tzupdater.ExternalModule.compileToJSRBinary(ExternalModule.java:153)
    at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:230)
    at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:634)
Caused by: tools.tzdb.DateTimeException: Invalid value for SecondOfDay value: 90000
    at tools.tzdb.ChronoField.checkValidValue(ChronoField.java:173)
    at tools.tzdb.LocalTime.ofSecondOfDay(LocalTime.java:210)
    at tools.tzdb.TzdbZoneRulesCompiler.parseMonthDayTime(TzdbZoneRulesCompiler.java:475)
    at tools.tzdb.TzdbZoneRulesCompiler.parseRuleLine(TzdbZoneRulesCompiler.java:399)
    at tools.tzdb.TzdbZoneRulesCompiler.parseFile(TzdbZoneRulesCompiler.java:354)
    ... 5 more

Was this problem actually fixed? Or is there another workaround? Thanks.

标签: java timezone
2条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-07-26 11:22

Currently, the TZUpdater tool is only compatible with the "rearguard" data format, which no longer has pre-built binaries. IANA has never published them, but Paul Eggert (the TZ maintainer) was previously publishing them on his own personal site. He has decided not to do that any more. (There's a long thread in the TZDB mailing list about this.)

Fortunately, you can build them yourself through the following procedure:

  • Download the complete distribution file tzdb-2019b.tar.lz from IANA.
  • On a POSIX system (Ubuntu Linux assumed here):
    • sudo apt install lzip (if you don't have it already)
    • lzip -d tzdb-2019b.tar.lz
    • tar xvf tzdb-2019b.tar
    • cd tzdb-2019b
    • make rearguard_tarballs

The resulting tzdata2019b-rearguard.tar.gz file is compatible with TZUpdater:

java -jar tzupdater.jar -v -l tzdata2019b-rearguard.tar.gz

Hopefully this will eventually get resolved with an updated version of TZUpdater that understands the release format without requiring rearguard data.

查看更多
家丑人穷心不美
3楼-- · 2020-07-26 11:44

I'd like to comment that Matt's solution also works using Cygwin on Windows, just make sure to install packages lzip and make as they are not selected by default.

Only this I did not get working on Windows is using a local file. java -jar tzupdater.jar -v -l tzdata2019b-rearguard.tar.gz and java -jar tzupdater.jar -v -l file://tzdata2019b-rearguard.tar.gz don't work for me, so I copied to an internal server and then was able to update using java -jar tzupdater.jar -v -l http://some-iis-server/tzdata2019b-rearguard.tar.gz

查看更多
登录 后发表回答