What can cause this difference in performance during iodine?

This test program:

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import java.util.Locale;

public class Test
{
    public static void main( String[] args )
    {
        DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern( "dd-MMM-yyyy H:mm:ss z" ).withLocale( Locale.FRANCE );
        String print = dateTimeFormatter.print( new DateTime() );
        System.out.println( "print = " + print );
    }
}

Gives another output in Java 1.8.0_11 and 1.8.0_60:

update 11: 11-sept.-2015 16:23:38 CEST

update 60: 11-sept.-2015 16:21:46 +02:00

Both use Joda Time 2.6. Any idea why this is?

(Using Java 6 with Joda Time 2.0 also gives 11-sept.-2015 16:31:07 CEST)

+4
source share
1 answer

See the JodaTime 2.8.1 release notes for the JDK 8u60.

Changes in 2.8.1

  • Fixed for processing JDK 8u60 [# 288 , # 291] > Without this fix, formatting the time zone will print "+00: 00" instead of "GMT" for GMT time zone

and related error reports.

Joda Time DefaultNameProvider#getNameSet() . , , JDK java.text.DateFormatSymbols#getZoneStrings(), String[][].

JodaTime <= 2.8 DefaultNameProvider#getNameSet() :

if (strings != null && strings.length == 5 && id.equals(strings[0])) {
    // ...
    // we have found the time zone name
}

strings - String[][], DateFormatSymbols#getZoneStrings(). strings.length == 5.

JDK < 8u60 DateFormatSymbols#getZoneStrings() 5- , .

[America/Los_Angeles, Pacific Standard Time, PST, Pacific Daylight Time, PDT]

JDK 8u60 7 , .

[America/Los_Angeles, Pacific Standard Time, PST, Pacific Daylight Time, PDT, Pacific Time, PT]

strings.length == 5 . Joda Time 2.8.1 strings.length >= 5 ( "CEST" ).

+3

Source: https://habr.com/ru/post/1606971/


All Articles