TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta)

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Edition Windows 11 Pro
      Version 22H2
      Installed on ‎24-‎06-‎2023
      OS build 22621.4317
      Experience Windows Feature Experience Pack 1000.22700.1041.0


      A DESCRIPTION OF THE PROBLEM :
      Ran into this issue with a Spring Boot project utilizing JPA/Hibernate with a PostgreSQL Database (v17) hosted on a Hetzner VPS

      Main issue when running the application was the consistent error Unable to obtain isolated JDBC connection [FATAL: invalid value for parameter "TimeZone": "Asia/Calcutta"]

      Issue exists within tzmappings and not JDBC / PSQL DB. TimeZone.getDefault().getID() returns Asia/Calcutta. tzmappings should map "India Standard Time" (as given by windows) to Asia/Kolkata and not Asia/Calcutta

      Adding line
      India Standard Time:001:Asia/Kolkata:
      to tzmappings fixes the issue

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Live in the specific timezone (Asia/Kolkata)
      2. Utilize in-built java.util.TimeZone
      3. Call TimeZone.getDefault() to get system default timezone

      ---------- BEGIN SOURCE ----------
      package dev.arnitdo.krakoa;

      import java.util.TimeZone;

      public class TZTest {
          public static void main(String[] args) {
              System.out.println(
                  TimeZone.getDefault().getID()
              );
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Manually adding the below line in tzmappings

      BEFORE:
      Hawaiian Standard Time:001:Pacific/Honolulu:
      India Standard Time:001:Asia/Calcutta:
      Iran Standard Time:001:Asia/Tehran:

      AFTER:
      Hawaiian Standard Time:001:Pacific/Honolulu:
      India Standard Time:001:Asia/Kolkata: (<- This line added)
      India Standard Time:001:Asia/Calcutta:
      Iran Standard Time:001:Asia/Tehran:

      FREQUENCY :
      ALWAYS

            Assignee:
            Naoto Sato
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: