RFR: JDK-8326908: DecimalFormat::toPattern throws OutOfMemoryError when pattern is empty string [v4]

Justin Lu jlu at openjdk.org
Tue Mar 5 21:41:00 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.
> 
> For an empty String pattern DecimalFormat, the maximum fraction digits is initialized to `Integer.MAX_VALUE`. When toPattern() is invoked, StringBuilder internally doubles capacity attempting to append Integer.MAX_VALUE digits until OOME occurs. CSR covers potential behavioral compatibility changes.

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

  locale no longer needed, remove unusued imports

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18094/files
  - new: https://git.openjdk.org/jdk/pull/18094/files/7ee87fc2..e9e86da7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18094&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18094&range=02-03

  Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 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 core-libs-dev mailing list