JDK-8152154 : Changed date format from previous version
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2016-03-17
  • Updated: 2016-04-28
  • Resolved: 2016-03-20
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+109-2016-03-09-204013.javare.4620.nc)



ADDITIONAL OS VERSION INFORMATION :
Generic

A DESCRIPTION OF THE PROBLEM :
Date parsing using the default formatter fails where it previously succeeded

REGRESSION.  Last worked in version 8u74

ADDITIONAL REGRESSION INFORMATION: 
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+109-2016-03-09-204013.javare.4620.nc)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code should exit normally
ACTUAL -
There is an exception

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.text.ParseException: Unparseable date: "3/11/16 10:59:00 PM"
        at java.text.DateFormat.parse(DateFormat.java:366)
        at Test2.main(Test2.java:8)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.text.DateFormat;
import java.util.Locale;

public class Test {
    public static void main(String[] args) throws Throwable {
        DateFormat.getDateTimeInstance(DateFormat.SHORT,
                DateFormat.MEDIUM,
                Locale.US).parse("3/11/16 10:59:00 PM");
    }
}

---------- END SOURCE ----------


Comments
COMPAT is the official name for designating the legacy JRE locale data in JDK 9. JRE is still supported for compatibility. " java -Djava.locale.providers=COMPAT,CLDR JI9032375" is preferred.
20-03-2016

JDK 8 has JRE as default locale provider, whereas in JDK 9 onwards CLDR is the default locale provider. (http://openjdk.java.net/jeps/252 ) To enable behavior compatible with JDK 8, set the system property java.locale.providers to a value with JRE ahead of CLDR. In JDK 9 ,if we run the test case as " java -Djava.locale.providers=JRE,CLDR JI9032375" it is successful. Closing as not an issue.
18-03-2016