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

Justin Lu jlu at openjdk.org
Thu Oct 3 21:02:16 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.

Justin Lu has updated the pull request incrementally with one additional commit since the last revision:

  address Chen's comment - provide a NPE setter whitelist in test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21315/files
  - new: https://git.openjdk.org/jdk/pull/21315/files/9bcf8996..bd6b021c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21315&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21315&range=00-01

  Stats: 74 lines in 2 files changed: 49 ins; 20 del; 5 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