On Wed, 28 Feb 2024 15:48:05 GMT, Andy Goryachev <[email protected]> wrote:
>> If a test runs in non-English locale, the digits displayed in the timeout >> could be locale-specific, which may be confusing. >> >> For example, in the Arabic locale `-Duser.language=ar`, the timeout is >> displayed like this: >> >> Test timeout: ٠٠:٠٤:٥٨ >> >> The fix explicitly sets English locale for formatting, which ensures the >> timeout is always displayed with the Western Arabic numerals, see [Numerals >> in most popular >> systems](https://en.wikipedia.org/wiki/Numerical_digit#Numerals_in_most_popular_systems). > > test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 644: > >> 642: long seconds = (leftTime - hours * 3_600_000 - minutes * >> 60_000) / 1_000; >> 643: label.setText(String.format(Locale.ENGLISH, >> 644: "Test timeout: %02d:%02d:%02d", > > is this the only place where we must enforce the locale? Surely, there must > be many, many other occurrences! In the `PassFailJFrame` class, there's no more code which depends on locale. This is the only place where something is formatted. Other tests, including those that use the `PassFailJFrame` framework, may depend on the current locale. It is not a goal to update all possible tests which may fail in non-English locale to use an English locale explicitly. There are tests which explicitly set the locale, for example [`PageDialogMarginTest.java`](https://github.com/openjdk/jdk/blob/b938a5c9edd53821a52b43a8e342b76adb341a3f/test/jdk/java/awt/print/PrinterJob/PageDialogMarginTest.java#L45). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18042#discussion_r1506222222
