8037343: Wrong dateformat for locale es_DO
authormfang
Thu, 22 May 2014 08:13:14 -0700
changeset 24511 5f539eb2a8a6
parent 24505 d2c5179475ea
child 24512 edece54a1aee
8037343: Wrong dateformat for locale es_DO Reviewed-by: okutsu Contributed-by: me@sandipan.net
jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java
jdk/test/sun/text/resources/Format/Bug8037343.java
jdk/test/sun/text/resources/LocaleData
jdk/test/sun/text/resources/LocaleDataTest.java
--- a/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Wed May 21 10:22:20 2014 +0200
+++ b/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Thu May 22 08:13:14 2014 -0700
@@ -75,8 +75,8 @@
                 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
+                    "dd/MM/yyyy", // medium date pattern
+                    "dd/MM/yy", // short date pattern
                 }
             },
             { "DateTimePatterns",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/text/resources/Format/Bug8037343.java	Thu May 22 08:13:14 2014 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8037343
+ * @summary updating dateformat for es_DO
+ */
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Locale;
+
+public class Bug8037343
+{
+
+    public static void main(String[] arg)
+    {
+        final Locale esDO = new Locale("es", "DO");
+        final String expectedShort = "31/03/12";
+        final String expectedMedium = "31/03/2012";
+
+        int errors = 0;
+        DateFormat format;
+        String result;
+
+        Calendar cal = Calendar.getInstance(esDO);
+        cal.set(Calendar.DAY_OF_MONTH, 31);
+        cal.set(Calendar.MONTH, Calendar.MARCH);
+        cal.set(Calendar.YEAR, 2012);
+
+        format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
+        result = format.format(cal.getTime());
+        if (!expectedShort.equals(result)) {
+            System.out.println(String.format("Short Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedShort, result));
+            errors++;
+        }
+
+        format = DateFormat.getDateInstance(DateFormat.MEDIUM, esDO);
+        result = format.format(cal.getTime());
+        if (!expectedMedium.equals(result)) {
+            System.out.println(String.format("Medium Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedMedium, result));
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException();
+        }
+    }
+
+}
--- a/jdk/test/sun/text/resources/LocaleData	Wed May 21 10:22:20 2014 +0200
+++ b/jdk/test/sun/text/resources/LocaleData	Thu May 22 08:13:14 2014 -0700
@@ -483,8 +483,8 @@
 FormatData/es_DO/TimePatterns/3=hh:mm a
 FormatData/es_DO/DatePatterns/0=EEEE d' de 'MMMM' de 'yyyy
 FormatData/es_DO/DatePatterns/1=d' de 'MMMM' de 'yyyy
-FormatData/es_DO/DatePatterns/2=MM/dd/yyyy
-FormatData/es_DO/DatePatterns/3=MM/dd/yy
+# FormatData/es_DO/DatePatterns/2=MM/dd/yyyy # Changed: see bug 8037343
+# FormatData/es_DO/DatePatterns/3=MM/dd/yy # Changed: see bug 8037343
 FormatData/es_DO/DateTimePatterns/0={1} {0}
 FormatData/es_DO/NumberElements/0=.
 FormatData/es_DO/NumberElements/1=,
@@ -7692,3 +7692,7 @@
 FormatData/es_EC/TimePatterns/1=H:mm:ss z
 FormatData/es_EC/TimePatterns/2=H:mm:ss
 FormatData/es_EC/TimePatterns/3=H:mm
+
+# bug 8037343
+FormatData/es_DO/DatePatterns/2=dd/MM/yyyy
+FormatData/es_DO/DatePatterns/3=dd/MM/yy
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Wed May 21 10:22:20 2014 +0200
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Thu May 22 08:13:14 2014 -0700
@@ -36,6 +36,7 @@
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
+ *      8037343
  * @summary Verify locale data
  *
  */