<i18n dev> RFR: 8299677: Formatter.format might take a long time to format an integer or floating-point [v4]

balcanuc duke at openjdk.org
Mon Jan 16 17:24:20 UTC 2023


On Thu, 12 Jan 2023 11:40:32 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8299677: Formatter.format might take a long time to format an integer or floating-point
>
> src/java.base/share/classes/java/util/Formatter.java line 4600:
> 
>> 4598:             // apply zero padding
>> 4599:             if (width > sb.length() && Flags.contains(f, Flags.ZERO_PAD)) {
>> 4600:                 String zeros = Character.toString(zero).repeat(width - sb.length());
> 
> `Character.toString(zero)` could be replaced directly with `String.valueOf(zero)` saving one more method call

is the bug going to be backported to JDK8? Due to the use of 'repeat' this seems to not be possible.

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

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


More information about the i18n-dev mailing list