JDK-8327486 : java/util/Properties/PropertiesStoreTest.java fails "Text 'xxx' could not be parsed at index 20" after 8174269
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2024-03-06
  • Updated: 2024-04-22
  • Resolved: 2024-03-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21 JDK 23
21.0.4-oracleFixed 23 b14Fixed
Related Reports
Relates :  
Description
java/util/Properties/PropertiesStoreTest.java fails:

Using locale:  for Properties#store(OutputStream) test
test PropertiesStoreTest.testStoreOutputStreamDateComment(): failure
java.lang.AssertionError: Unexpected date comment: Wed Mar 06 23:25:14 CST 2024
	at org.testng.Assert.fail(Assert.java:87)
	at PropertiesStoreTest.testDateComment(PropertiesStoreTest.java:247)
	at PropertiesStoreTest.testStoreOutputStreamDateComment(PropertiesStoreTest.java:217)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at org.testng.TestRunner.privateRun(TestRunner.java:764)
	at org.testng.TestRunner.run(TestRunner.java:585)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
	at org.testng.SuiteRunner.run(SuiteRunner.java:286)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
	at org.testng.TestNG.runSuites(TestNG.java:1069)
	at org.testng.TestNG.run(TestNG.java:1037)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: java.time.format.DateTimeParseException: Text 'Wed Mar 06 23:25:14 CST 2024' could not be parsed at index 20
	at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2108)
	at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1936)
	at PropertiesStoreTest.testDateComment(PropertiesStoreTest.java:245)
	... 30 more
Using locale: ksh for Properties#store(OutputStream) test

This testcase failed on 2024-03-06 04:00:00 CST, passed on 2024-03-06 02:00:06 CST
Comments
Fix request [21u] I backport this for parity with 21.0.4-oracle. No risk, only a test change. Clean backport. Test passes. SAP nightly testing passed.
21-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/511 Date: 2024-04-19 11:25:12 +0000
19-04-2024

Changeset: e21da4ca Author: SendaoYan <syan@openjdk.org> Committer: Jie Fu <jiefu@openjdk.org> Date: 2024-03-12 01:38:20 +0000 URL: https://git.openjdk.org/jdk/commit/e21da4caacb464827270d20b8fc62a50a1706316
12-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18155 Date: 2024-03-07 16:47:01 +0000
07-03-2024

Mine OS version information is: > cat /etc/os-release ; uname -a NAME="Alibaba Cloud Linux" VERSION="3 (Soaring Falcon)" ID="alinux" ID_LIKE="rhel fedora centos anolis" VERSION_ID="3" PLATFORM_ID="platform:al8" PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)" ANSI_COLOR="0;31" HOME_URL="https://www.aliyun.com/" Linux x31k05047.sqa.na131 5.10.134-007.ali5000.al8.aarch64 #1 SMP Fri Mar 3 18:39:24 CST 2023 aarch64 aarch64 aarch64 GNU/Linux > locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= This testcase passed with commit id c6641c7d2d5fd3e085e39646c9a350eeb83e3c5b, and failed with commit id 809995b526ea79e4fd9fd4f911bcce811f77eb89, show as below + cat PropertiesStoreTest.java import java.time.format.DateTimeFormatter; import java.util.Locale; public class PropertiesStoreTest { private static final String DATE_FORMAT_PATTERN = "EEE MMM dd HH:mm:ss zzz uuuu"; private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN, Locale.ROOT); public static void main(String[] args) { String comment = "Thu Mar 07 16:54:36 CST 2024"; FORMATTER.parse(comment); } } + javac PropertiesStoreTest.java + ./build/jdk-c6641c7d2d5fd3e085e39646c9a350eeb83e3c5b-0305-1624/bin/java PropertiesStoreTest + ./build/jdk-809995b526ea79e4fd9fd4f911bcce811f77eb89-0305-1932/bin/java PropertiesStoreTest Exception in thread "main" java.time.format.DateTimeParseException: Text 'Thu Mar 07 16:54:36 CST 2024' could not be parsed at index 20 at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2108) at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1936) at PropertiesStoreTest.main(PropertiesStoreTest.java:11)
07-03-2024

If I change the line 62 from DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN, Locale.ROOT) to DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN), i.e. delete the 2rd paramater Locale.ROOT, the java.time.format.DateTimeParseException disappear, and this testcase passed.
07-03-2024

The test passes for me on Macos and Linux in JDK mainline. Can you specify what OS and release it fails for you? Could there be a configuration problem on your test system?
07-03-2024

fails after 8174269
07-03-2024

The release note for 8325889 does say that some locale sensitive behavior changes may be possible: The `COMPAT` locale data provider has been removed from the JDK. Specifying `COMPAT` in `java.locale.providers` system property to the launcher command line will have no effect and will use the data from `CLDR`, which may cause incompatible locale-sensitive behavior, such as date/time/number formatting and parsing issues. Such applications are encouraged to migrate to CLDR data or consider a workaround discussed in the [CSR](https://bugs.openjdk.org/browse/JDK-8325568).
07-03-2024