JDK-8356450 : NPE in CLDRTimeZoneNameProviderImpl for tzdata downgrades after JDK-8342550
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-05-07
  • Updated: 2025-05-09
  • Resolved: 2025-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 masterFixed
Related Reports
Relates :  
Description
The following example shows an NPE in CLDRTimeZoneNameProviderImpl after downgrading the tzdata version from 2025b to 2025a.

2025b added a new time zone, America/Coyhaique. I think what's happening here is that sun.util.resources.cldr.TimeZoneNames is generated at built-time with a reference to the new zone, and at runtime sun.util.calendar.ZoneInfo.getTimeZone uses the older tzdata and returns null. Before JDK-8342550, the logic in CLDRTimeZoneNameProviderImpl used java.util.TimeZone.getTimeZone, which has fallback logic to return a non-null logic for the unknown zone and avoids the crash.

Note that the repro below requires passing 'tzupdater -f' to downgrade the version, otherwise it reports "Current JRE has later version (tzdata2025b) than the tzupdater provided one (tzdata2025a)." This suggests that downgrading tzdata versions in this way may not be a supported use-case, but I wanted to report this to confirm whether that's the case. This did previously work without the crash, even if it was a bad idea.

$ cat T.java
import java.text.DateFormatSymbols;
import java.util.Arrays;
import java.util.Locale;

class T {
  public static void main(String[] args) {
    System.err.println(DateFormatSymbols.getInstance(Locale.US).getZoneStrings().length);
  }
}

$ javac T.java

$ ./jdk25/bin/java T
632

$ ./jdk25/bin/java -jar /tmp/tzupdater.jar  -V
tzupdater version 2.3.3-b02
JRE tzdata version: tzdata2025b
tzupdater tool would update with tzdata version: tzdata2025b

$ ./jdk25/bin/java -jar /tmp/tzupdater.jar -f -l https://data.iana.org/time-zones/releases/tzcode2025a.tar.gz
Using https://data.iana.org/time-zones/releases/tzcode2025a.tar.gz as source for tzdata bundle.
WARNING: Use of the three-letter time zone ID "NST" is deprecated and it will be removed in a future release
java.lang.RuntimeException: Invalid TimeZone ID: NST

$ ./jdk25/bin/java T
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.TimeZone.toZoneId()" because the return value of "sun.util.calendar.ZoneInfo.getTimeZone(String)" is null
        at java.base/sun.util.cldr.CLDRTimeZoneNameProviderImpl.deriveFallbackNames(CLDRTimeZoneNameProviderImpl.java:135)
        at java.base/sun.util.cldr.CLDRTimeZoneNameProviderImpl.getZoneStrings(CLDRTimeZoneNameProviderImpl.java:128)
        at java.base/sun.util.locale.provider.TimeZoneNameUtility.loadZoneStrings(TimeZoneNameUtility.java:86)
        at java.base/sun.util.locale.provider.TimeZoneNameUtility.getZoneStrings(TimeZoneNameUtility.java:72)
        at java.base/java.text.DateFormatSymbols.getZoneStringsImpl(DateFormatSymbols.java:849)
        at java.base/java.text.DateFormatSymbols.getZoneStrings(DateFormatSymbols.java:564)
        at T.main(T.java:7)
Comments
Changeset: 5f00c877 Branch: master Author: Naoto Sato <naoto@openjdk.org> Date: 2025-05-09 16:16:56 +0000 URL: https://git.openjdk.org/jdk/commit/5f00c877e26f1716da231771b611234db5607fa7
09-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25130 Date: 2025-05-08 20:50:25 +0000
08-05-2025

The TZUpdater page lists the usage in the options chart, saying "Use this option if updating to an older tzdata version." So I guess it is a legitimate usage. https://www.oracle.com/java/technologies/javase/tzupdater-readme.html
08-05-2025