RFR: 8327486: java/util/Properties/PropertiesStoreTest.java fails "Text 'xxx' could not be parsed at index 20" after 8174269
Naoto Sato
naoto at openjdk.org
Thu Mar 7 21:09:53 UTC 2024
On Thu, 7 Mar 2024 16:47:01 GMT, SendaoYan <syan at openjdk.org> wrote:
> The DATE_FORMAT_PATTERN is set to "EEE MMM dd HH:mm:ss zzz uuuu", is the time format of US. So, creates a formatter should using Locale.US, rather than Locale.ROOT, which means empty.
Thanks for the fix. Although setting `Locale.US` to acquire the formatter is correct, the reasoning is not. The real reason is that `Date.toString()` uses `Locale.US` explicitly for printing the time zone https://github.com/openjdk/jdk/blob/972e81d1adb232b02114a5260d06144eb5b08849/src/java.base/share/classes/java/util/Date.java#L1045
Also, update the copyright year to 2024.
test/jdk/java/util/Properties/PropertiesStoreTest.java line 59:
> 57: private static final String DATE_FORMAT_PATTERN = "EEE MMM dd HH:mm:ss zzz uuuu";
> 58: // use a neutral locale, since when the date comment was written by Properties.store(...),
> 59: // it internally calls the Date.toString() which always writes in a locale insensitive manner
The comment here does not hold true any longer
-------------
PR Review: https://git.openjdk.org/jdk/pull/18155#pullrequestreview-1923533880
PR Review Comment: https://git.openjdk.org/jdk/pull/18155#discussion_r1516821399
More information about the core-libs-dev
mailing list