-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
9
-
b122
-
generic
-
generic
FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+151)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+151, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Abbreviated months such as "Jan", "Feb", etc, are throwing unparseable date errors in Java 9 when using the Australia locale (en_AU).
REGRESSION. Last worked in version 8u102
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_111"
Java(TM) SE Runtime Environment (build 1.7.0_111-b32)
Java HotSpot(TM) 64-Bit Server VM (build 24.111-b32, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to parse any date containing the "Month in year (context sensitive)" pattern using SimpleDateFormat with the en_AU locale.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The date would be successfully parsed.
ACTUAL -
ParseException, date cannot be parsed with Australian locale.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.text.ParseException: Unparseable date: "31/AUG/2016"
at java.base/java.text.DateFormat.parse(DateFormat.java:366)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Locale;
import java.text.ParseException;
import java.text.SimpleDateFormat;
class AUDate {
public static void main(String[] args) throws ParseException {
System.out.println("Parsing using ROOT locale...");
SimpleDateFormat rootDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.ROOT);
rootDateFormat.parse("31/AUG/2016"); // OK
System.out.println("Parsing using US locale...");
SimpleDateFormat usDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.US);
usDateFormat.parse("31/AUG/2016"); // OK
System.out.println("Parsing using AU locale...");
SimpleDateFormat auDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.forLanguageTag("en-AU"));
auDateFormat.parse("31/AUG/2016"); // Fail
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Pass -Djava.locale.providers=JRE,SPI to use old locale date as of JDK 7/8.
Alternatively the CLDR for en_AU seems to think we abbreviate our dates with a fullstop - e.g.
31/AUG/2016 throws an exception
31/AUG./2016 works
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+151)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+151, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Abbreviated months such as "Jan", "Feb", etc, are throwing unparseable date errors in Java 9 when using the Australia locale (en_AU).
REGRESSION. Last worked in version 8u102
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_111"
Java(TM) SE Runtime Environment (build 1.7.0_111-b32)
Java HotSpot(TM) 64-Bit Server VM (build 24.111-b32, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to parse any date containing the "Month in year (context sensitive)" pattern using SimpleDateFormat with the en_AU locale.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The date would be successfully parsed.
ACTUAL -
ParseException, date cannot be parsed with Australian locale.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.text.ParseException: Unparseable date: "31/AUG/2016"
at java.base/java.text.DateFormat.parse(DateFormat.java:366)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Locale;
import java.text.ParseException;
import java.text.SimpleDateFormat;
class AUDate {
public static void main(String[] args) throws ParseException {
System.out.println("Parsing using ROOT locale...");
SimpleDateFormat rootDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.ROOT);
rootDateFormat.parse("31/AUG/2016"); // OK
System.out.println("Parsing using US locale...");
SimpleDateFormat usDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.US);
usDateFormat.parse("31/AUG/2016"); // OK
System.out.println("Parsing using AU locale...");
SimpleDateFormat auDateFormat = new SimpleDateFormat("dd/MMM/yyyy", Locale.forLanguageTag("en-AU"));
auDateFormat.parse("31/AUG/2016"); // Fail
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Pass -Djava.locale.providers=JRE,SPI to use old locale date as of JDK 7/8.
Alternatively the CLDR for en_AU seems to think we abbreviate our dates with a fullstop - e.g.
31/AUG/2016 throws an exception
31/AUG./2016 works