RFR: 8354522: Clones of DecimalFormat cause interferences when used concurrently [v4]

Naoto Sato naoto at openjdk.org
Tue Apr 15 21:29:42 UTC 2025


On Tue, 15 Apr 2025 20:41:25 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> The `DigitList` class used in `DecimalFormat` does not reset the `data` array in its clone method. This can cause interference when clones are used concurrently.
>
> Johannes Graham has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Terminate test early on failure

test/jdk/java/text/Format/DecimalFormat/CloneTest.java line 77:

> 75:                             String str = String.valueOf(value);
> 76:                             if (!str.equals(dfString)) {
> 77:                                 mismatchCount.getAndIncrement();

`mismatchCount` is no longer needed. Simply break after printing the error message would suffice.

test/jdk/java/text/Format/DecimalFormat/CloneTest.java line 81:

> 79:                             }
> 80:                         }
> 81:                     } catch (InterruptedException e) {

I'd suggest throwing the exception (or RuntimeException with it as the cause), not swallowing it silently in the test.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24598#discussion_r2045541029
PR Review Comment: https://git.openjdk.org/jdk/pull/24598#discussion_r2045546462


More information about the core-libs-dev mailing list