Error updating tzdata 2018f (Released 2018-10-18) with tzupdater-2.2.0

前端 未结 8 884
既然无缘
既然无缘 2020-12-03 07:40

I\'m trying to update JVM\'s Time Zone info using TZUpdater 2.2.0.

> [root@local tzupdater-2.2.0]# java -jar tzupdater.jar -V
  tzupdater version 2.2.0-b0         


        
相关标签:
8条回答
  • 2020-12-03 07:58

    If you are having problems with the Japanese version, you can use another link for Brazil. java -jar tzupdater.jar -l https://data.iana.org/time-zones/releases/tzdata2018e.tar.gz

    0 讨论(0)
  • 2020-12-03 08:01

    Use these commands:

    sudo apt-get install oracle-java8-installer
    sudo update-alternatives --config java 
    

    and choose the number *0 (automatic)

    sudo update-alternatives --config javac
    

    and choose the same *0.

    If you already have the tzupdater only see the version of it that is already 2018

    java -jar tzupdater.jar -V
    
    0 讨论(0)
  • 2020-12-03 08:09

    I was running into the same error, then I fixed the downloaded file from IANA, using the following shell script, which replaces the troublesome line in the file by the previous version of "asia" file, as described by @lucas-basquerotto in his post below. I've tested and it works fine!

    Please, download the TZUpdater bundle, extract the tzupdater.jar and update the variable TZUPDATER_JAR with the full file path of the downloaded jar file in order to run the script successfully.

    #!/bin/bash
    
    #FULL PATH TO tzupdater.jar
    TZUPDATER_JAR='/home/user/tzupdater.jar'
    
    OUTPUT_ALL=$(java -jar $TZUPDATER_JAR -l 2>&1 >/dev/null)
    echo "$OUTPUT_ALL" | grep -e "Caused by: tools.tzdb.DateTimeException: Invalid value for SecondOfDay value: 90000" > /dev/null
    if [ $? -eq 0 ]
    then
            FIXME_FILE=$(echo "$OUTPUT_ALL" | grep -Po "(?<=java.lang.Exception: Failed while parsing file ').+(?=' on line 1655 'Rul)")
            echo "file $FIXME_FILE contains a syntax error"
    
            ERROR_LINE=$(sed -n '1656,1656p' $FIXME_FILE )
            echo "Line 1655 \"$ERROR_LINE\" contains an error"
            FIXED_LINE=${ERROR_LINE/Sat>=8/Sun>=9}
            FIXED_LINE=${FIXED_LINE/25:00/0:00}
            echo "Line 1655 fixed: \"$FIXED_LINE\" ( rule \"Sat>=8 25:00\" replaced by \"Sun>=9 0:00\" as it was used to be on previous version )"
            sed -i "s/$ERROR_LINE/$FIXED_LINE/" $FIXME_FILE
            TEMP_DIR_NAME=$(dirname $FIXME_FILE)
            cd $TEMP_DIR_NAME
            mkdir tzdata
            mv tzdata.tar.gz tzdata/
            cd tzdata/
            echo "untar original tzdata.tar.gz"
            tar -xf tzdata.tar.gz
            rm tzdata.tar.gz
    
            FIXME_FILENAME=$(basename $FIXME_FILE)
            echo "replacing original $FIXME_FILENAME file"
            rm $FIXME_FILENAME
            cp ../$FIXME_FILENAME $FIXME_FILENAME
            echo "building a new tar ball with the fixing"
            tar -czf ../tzdata-updated.tar.gz *
            echo "installing the updated tar file (requires elevation sudo)"
            sudo java -jar $TZUPDATER_JAR -l "file:///$TEMP_DIR_NAME/tzdata-updated.tar.gz"
            if [ $? -ne 0 ]
            then
                    echo "something went wrong!"
                    exit 2
            fi
    fi
    echo "installation successful!"
    

    Save this is script under the name update_jdk_tzdata.sh and grant it permission to execute: chmod +x update_jdk_tzdata.sh and execute it ./update_jdk_tzdata.sh (it requires sudo in order to update JRE files)

    0 讨论(0)
  • 2020-12-03 08:12

    Since tzdata2018g is already released with the fix provided in rearguard format, please use the rearguard tzdata bundle with -l option.

    For tzdata2018g the command will look like this:
    java -jar tzupdater.jar -l https://web.cs.ucla.edu/~eggert/tz/release/2018g/tzdata2018g-rearguard.tar.gz

    0 讨论(0)
  • 2020-12-03 08:15

    Update your version of Java 8; the tzupdater tool just works in Java 8 update 181.

    0 讨论(0)
  • 2020-12-03 08:19

    Had the same issue here, and the problem seems to be just on the latest version.

    Using

    java -jar tzupdater.jar -l https://data.iana.org/time-zones/releases/tzdata2018d.tar.gz
    

    (if "2018d" is enough for you) should work fine.

    For some reason, after that, upgrading to the latest tzdata also worked fine (with just a warning).

    0 讨论(0)
提交回复
热议问题