On Sat, 2 Mar 2024 00:34:32 GMT, Justin Lu <j...@openjdk.org> wrote: > 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.
Would declaring an object for the input and then invoking the two methods on the same object rather than creating two objects be considered an alternative? ------------- Marked as reviewed by rajuc...@github.com (no known OpenJDK username). PR Review: https://git.openjdk.org/jdk/pull/18094#pullrequestreview-1915406613