JDK-8037343 : Wrong dateformat for locale es_DO
  • Type: Bug
  • Component: globalization
  • Sub-Component: locale-data
  • Affected Version: 7u21,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-03-03
  • Updated: 2016-09-05
  • Resolved: 2014-05-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b15Fixed
Description
FULL PRODUCT VERSION :
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Tested on ubuntu/linux 10.04 and earlier
macosx 10.6 and earlier

A DESCRIPTION OF THE PROBLEM :
The locale es_DO from your implementation, produces a DateFormat as month, day and year. This is not the date format use in the Dominican Republic it is day, month and year.

ADDITIONAL REGRESSION INFORMATION: 
It seems that this is an old bug.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Write a code:

Locale esDO = new Locale("es", "DO");
DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
Calendar cal = Calendar.getInstance(esDO);
cal.set(Calendar.DAY_OF_MONTH, 31);
cal.set(Calendar.MONTH, Calendar.MARCH);
cal.set(Calendar.YEAR, 2012);
System.out.println(esDO + " - " + format.format(cal.getTime()));


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
es_DO - 31/03/12
ACTUAL -
es_DO - 03/31/12

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages

REPRODUCIBILITY :
This bug can be reproduced always.

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

public class ATest {
	public static void main(String[] args) throws Exception {
		Locale esDO = new Locale("es", "DO");
		DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
		Calendar cal = Calendar.getInstance(esDO);
		cal.set(Calendar.DAY_OF_MONTH, 31);
		cal.set(Calendar.MONTH, Calendar.MARCH);
		cal.set(Calendar.YEAR, 2012);
		System.out.println(esDO + " - " + format.format(cal.getTime()));
	}
}

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


Comments
Verified the regression-test: sun/text/resources/Format/Bug8037343.java pass with JDK9 b130.
05-09-2016

According to wikipedia, the request is reasonable. http://en.wikipedia.org/wiki/Date_format_by_country Dominican Republic DMY The file ./sun/text/resources/es/FormatData_es_DO.java (jdk9) has the following entry in FormatData_es_DO: { "DatePatterns", new String[] { "EEEE d' de 'MMMM' de 'yyyy", // full date pattern "d' de 'MMMM' de 'yyyy", // long date pattern "MM/dd/yyyy", // medium date pattern "MM/dd/yy", // short date pattern } }, So, the full and long date pattern are correct, while medium and short are not.
14-03-2014