On Tue, 5 Sep 2023 19:50:29 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> src/java.base/share/classes/java/text/ListFormat.java line 521:
>> 
>>> 519:         var sb = new StringBuilder(256).append(patterns[START]);
>>> 520:         IntStream.range(2, count - 1).forEach(i -> 
>>> sb.append(middleBetween).append("{").append(i).append("}"));
>>> 521:         sb.append(patterns[END].replaceFirst("\\{0}", 
>>> "").replaceFirst("\\{1}", "\\{" + (count - 1) + "\\}"));
>> 
>> From what it looks, it could be a concern for potentially adding large 
>> number of long strings with a list of small items. I don't seem to see where 
>> the input is limited.
>
> Good point. Will add some kind of limitation.

I can't see what arbitrary limit would make sense.
But perhaps an APINote that  formatting the string from an excessively long 
list may exceed memory or string sizes. (Without being specific about the 
exception being thrown).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15130#discussion_r1316371355

Reply via email to