Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: more porting issues to Java 11 Date: Mon, 29 Apr 2019 08:23:52 -0000 (UTC) Organization: A noiseless patient Spider Lines: 31 Message-ID: References: Reply-To: avl@logic.at Injection-Date: Mon, 29 Apr 2019 08:23:52 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="bf1d692746f695054c5d93eb4cfd5148"; logging-data="21120"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ELSwFYNSvHUPlJN1DIzgT" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:8vgEwfet2X3buJYRAbfo13EkVNI= Xref: csiph.com comp.lang.java.programmer:38938 Sebastian wrote: > Am 10.04.2019 um 20:08 schrieb Andreas Leitgeb: > [snip] >> Next obstacle was SimpleDateFormat: jdk-8 had no problem at all with >> parsing a (German style) "10.04.2019 19:44:45" string with a DateFormat >> DateFormat df = DateFormat.getDateTimeInstance(dfMed,dfMed,l_de); >> For jdk11, the string would now need a comma "," between date and time >> parts. the blank isn't acceptable any more. Afternote: the new format would have expected comma and blank between date and time. > Starting in JDK 9, the Unicode Consortium's Common Locale Data > Repository (CLDR) data is enabled as the default locale data, so that > you can use standard locale data without any further action. [snip] > To enable behavior compatible with JDK 8, set the system property > java.locale.providers to a value with COMPAT ahead of CLDR, for example, > java.locale.providers=COMPAT,SPI,CLDR. This will have the same behavior > with the prior JDK releases. Indeed, that was it. Setting the property worked as expected, but I decided to change creation of DateFormat instances to use exactly the format I want. (There were only a couple of places in my code) I now use new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); The literal String here is really a constant defined in a central place. That's the spec of the strings I need to parse and it was only "coincidence" that it even corresponded to German locale before. Thanks a lot!