"Unparseable date" using Gen Classic Java Proxy with Java 11
search cancel

"Unparseable date" using Gen Classic Java Proxy with Java 11


Article ID: 268172


Updated On:


Gen Gen - Host Encyclopedia Gen - Run Time Distributed Gen - Workstation Toolset


After compiling Classic Java Proxy with Java 11 JDK and running using Java 11JVM/JRE the input date format "dd/mm/yyyy" (e.g. "13/06/2023") that is accepted with the previous Java 8 version of the proxy is not able to be parsed i.e.

Exception: java.text.ParseException: Unparseable date: "13/06/2023"


Release: Gen 8.6 Complete and latest PTFs


Gen L1 Support recreated the same behaviour and it only occurs when using the Classic Java Proxy i.e. the Standard Java Proxy does not show the problem.

After further research it was found that there have been some default date format changes in Java 9 and above. The Classic Java proxy uses Java class DateFormat in its generated code for the MainUI while the Standard Java proxy does not. This web page covers an example of how to restore the Java 8 behaviour:
It advises adding the system property "-Djava.locale.providers=COMPAT,CLDR" to the JVM command line to get the same behaviour as Java 8.


It was found that running the Java 11 compiled Classic Java Proxy using Java 11 JVM with the above additional system property allowed the same date format to be parsed that was accepted with the previous Java 8 compiled proxy. In fact, the COMPAT value was enough to enable successful parsing of the date format i.e. "-Djava.locale.providers=COMPAT".

So this Classic Java proxy behaviour change with Java 11 is purely due to a JVM default date format change and is not actually due to a Gen specific problem.

NOTE: In general the required date format will be specific to the Locale on the local Windows machine - see #3 in Additional Information.

Additional Information

1. Executing the Sample Java Proxy (Classic Style) Applications

2. Another option instead of using the system property is to customise the generated code for the MainUI sample to use whatever date format is required. In general, the proxy sample programs are just samples that can be recoded by the Gen Developer as required.
Support tested changing the MainUI generated code (model.ief\proxy\java\src\server_manager\MainUI\server_managerUI.java) to use object SimpleDateFormat as follows:
BEFORE: private DateFormat dateFormatter = DateFormat.getDateInstance();
AFTER:    private DateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
After rebuilding the proxy via the Buiuld Tool using Java 11, the format of "13/06/2023" was accepted at runtime without needing to use the system property.

3. The attached Java program code TestDateFormat.java can also be used to test the default outputs on a particular machine/locale from the objects DateFormat (used by the sample MainUI) and SimpleDateFormat (used by the sample Abean). An output of the system properties is also included which will show the current Locale in property "user.country".


1687231089963__TestDateFormat.java get_app