<i18n dev> RFR: JDK-8326908: DecimalFormat::toPattern throws OutOfMemoryError when pattern is empty string

Justin Lu jlu at openjdk.org
Sat Mar 2 00:39:19 UTC 2024


Please review this PR and corresponding CSR which prevents an OutOfMemoryError by restricting the initial maximum fraction digits for an empty pattern DecimalFormat.

The cause is that the maximum fraction digits is initialized to `Integer.MAX_VALUE` which causes StringBuilder to eventually throw OOME when internally doubling capacity too many times when toPattern is invoked. CSR covers potential behavioral compatibility changes.

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

Commit messages:
 - minor additions
 - init

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

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


More information about the i18n-dev mailing list