5 Kasım 2016 Cumartesi

Don't forget to turn forward your clock for Daylight Saving Time !

Lots of jokes about time were flying around due to annual changes on DTS compliance (!) of my beloved country. Finally it is decided to be on GMT+3. I had to take care of my iPhone, squeeze box, laptop etc. Off the record, I prepared my full mechanic watch for 2 days not to miss the time :).

The DTS thing always should be considered by the owner of any product that depends on java. Although the owners of jdk and the other time related libraries publish a patch or version, they are mostly being one step behind the governments.

As of today, i have faced to problems of my clients on various system jdks and even on my MacBook !. Of course there is a solution - but not trivial - for the problem and i was trained on the subject before for some reason.

May be some systems can easily be upgraded to the latest timezone but my MacBook did not let things to go that way. Let me explain my journey.

I will go step by step:
  1. If you google a bit you will find the oracle web site about tzupdater and procedure of update process. Download the tzupdater.jar. 
  2. Internet Assigned Numbers Authority (IANA) is preparing  and distributing the timezone data. Copy the link of the data file tzcode2016i.tar.gz.
  3. According to the document it is ok if you can execute command                                            java -jar tzupdater.jar -l http://www.iana.org/time-zones/repository/tzdata-latest.tar.gz
  4. but not ! Because there is a bug. Do not make it a big problem if your code has bugs, and tell about this if any one complain about your bugs !
  5. Then read the Version issue since tzdata 2016g release" section of the oracle document and recreate the gz file after downloading, extracting and modifying. I created and named the new file as 2016i.tar.gz. Be careful while creating the tar, because the tar should be crated as all the files included in root, no directory permitted inside. It is done by executing tar in the folder where files resides. See this.
  6. And than execute the command as below (replay the path with your real path):                    sudo java -jar tzupdater.jar -v -l file:///Users/xxx/xxx/xxx/2016i.tar.gz                                     to get the next step of bugs. 
  7. This one is related with sh512, as details explained on Version Issues section. From this site download the gui application and generate the sh512 hash code of the 2016.tar.gz. Create a new file text file with name 2016.tar.gz.sha512. Put the hash code as one line in the file and place the file at the same path with 2016.tar.gz.  Lets re-execute the command :                             sudo java -jar tzupdater.jar -v -l file:///Users/xxx/xxx/xxx/2016i.tar.gz
  8. if you are lucky enough, your timezone information is updated successfully. But if you get and error of "Error. SHA-512 hash for downloaded bundle does not match expected SHA-512 hash" do not panic, the clever developer guys of the tool are dumping you the real hash key if your key does not match with the one you provided.                                                              Error. SHA-512 hash for downloaded bundle does not match expected SHA-512 hash.   Expected  : 5FA87187DCB57FA1C3FF632B65B37B4C9F00990075832423DB886D18A8774595556709A19E79327F8C52B6F311695B49935862917045DF9234D6E5409FA8F209                Calculated : 5fa87187dcb57fa1c3ff632b65b37b4c9f00990075832423db886d18a8774595556709a19e79327f8c52b6f311695b49935862917045df9234d6e5409fa8f209                                                         (if you released that my hash was just the same key with characters in uppercase.)
  9. copy the calculated key and replace yours with new key then execute the command again !
          Bingo ! Enjoy your new timezone data.

Special Note For Jodatime users: For the ones using jodatime life is much more. Although the library is not using the same tz data with idk, they are more rapid than the jdk releases and they released the version 2.9.5 two days ago including timezone update to 2016i :)