Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38899

Re: more porting issues to Java 11

From Sebastian <nowhere@nirvana.org>
Newsgroups comp.lang.java.programmer
Subject Re: more porting issues to Java 11
Date 2019-04-11 11:05 +0200
Organization albasani.net
Message-ID <q8mvvs$g42$1@news.albasani.net> (permalink)
References (2 earlier) <slrnqac06q.cfl.avl@logic.at> <q86743$ee6$1@gioia.aioe.org> <slrnqamuc3.cfl.avl@logic.at> <slrnqan0bh.cfl.avl@logic.at> <slrnqasc8j.cfl.avl@logic.at>

Show all headers | View raw


Am 10.04.2019 um 20:08 schrieb Andreas Leitgeb:
> Next update:    (tl;dr? SimpleDateFormat also changed behaviour)
> 
[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
> defined like this: (SSCCE and results further down)
>    final int dfMed = DateFormat.MEDIUM; final Locale l_de=new Locale("de","DE");
>    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.
> 
[snip]

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.

In JDK 8, although CLDR locale data is bundled with the JRE, it isn't 
enabled by default.

Code that uses locale-sensitive services such as date, time, and number 
formatting may produce different results with the CLDR locale data.

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.

The system property itself dates from Java 8. From the documentation of 
LocaleServiceProvider: “Starting from JDK8, the search order of locale 
sensitive services can be configured by using the 
"java.locale.providers" system property.”

What would be the alternative to using compatibility mode? Answer: 
Sticking to CLDR would most likely imply having to change some patterns 
in the app, e. g. "u" should be used for years for week-based formatting 
or with strict resolvers, the short date format changed from d-M-yy to 
dd-MM-yy, distinguishing between format and standalone style (e vs. c in 
the case of months and perhaps more).

All of this would probably require switching entirely to the standard 
Java date and time API instead of using the outdated SimpleDateFormat 
and relatives, which don't support all of the new format fields or use 
them with a different meaning. Using the old date time classes together 
with GLDR as a data source cannot be recommended.

-- Sebastian

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-03 17:21 +0000
  Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-03 14:28 -0400
    Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-03 14:32 -0400
      Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-04 12:52 +0000
        Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-04 14:11 +0000
          Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-04 20:08 -0400
  Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-03 14:37 -0400
    Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-04 13:04 +0000
      Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-04 20:22 -0400
        Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-08 16:40 +0000
          Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-08 17:14 +0000
            Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-10 18:08 +0000
              Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-10 18:32 +0000
              Re: more porting issues to Java 11 Sebastian <nowhere@nirvana.org> - 2019-04-11 11:05 +0200
                Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-29 08:23 +0000
              Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 10:08 -0400
                Re: more porting issues to Java 11 Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 07:35 -0700
              Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-29 08:39 +0000
                Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-05-03 13:10 +0000
                Re: more porting issues to Java 11 Knute Johnson <groups@585ranch.com> - 2019-05-04 11:24 -0500
                Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-05-04 21:58 +0000
                Re: more porting issues to Java 11 Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2019-05-06 11:25 -0500
                Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-05-29 12:20 +0000
                Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2020-01-30 15:07 +0000
          Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-08 18:41 -0400
            Re: more porting issues to Java 11 Sebastian <nowhere@nirvana.org> - 2019-04-10 15:46 +0200
              Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-10 12:31 -0400
            Re: more porting issues to Java 11 Andreas Leitgeb <avl@logic.at> - 2019-04-10 18:13 +0000
              Re: more porting issues to Java 11 Arne Vajhøj <arne@vajhoej.dk> - 2019-04-13 20:39 -0400

csiph-web