<i18n dev> RFR: 8341445: DecimalFormatSymbols can throw NPE for equals()

Justin Lu jlu at openjdk.org
Wed Oct 2 23:20:50 UTC 2024


Please review this PR which improves the safety of equality checking for DecimalFormatSymbols.

DecimalFormatSymbols via its setters, allows certain instance variables to be set as null. (Note that some variables are allowed to be null, and others are not.) However, non null safe comparisons are used for all variables during the equality check. This can lead to an unexpected NPE when `DecimalFormatSymbols.equals()` is invoked.

The nullable variables in question should be equality checked via the static `Object.equals()`. An associated regression test is added to confirm the change.

-------------

Commit messages:
 - small shortening of MethodSource
 - init

Changes: https://git.openjdk.org/jdk/pull/21315/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21315&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341445
  Stats: 113 lines in 2 files changed: 109 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/21315.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21315/head:pull/21315

PR: https://git.openjdk.org/jdk/pull/21315


More information about the i18n-dev mailing list