changeset 9665:56e6500fd5a0

8037343: Wrong dateformat for locale es_DO Reviewed-by: okutsu Contributed-by: me@sandipan.net
author mfang
date Fri, 13 Jun 2014 09:11:54 -0700
parents 0e282718e324
children 21ce22c3b69e
files src/share/classes/sun/text/resources/es/FormatData_es_DO.java test/sun/text/resources/Format/Bug8037343.java test/sun/text/resources/LocaleData test/sun/text/resources/LocaleDataTest.java
diffstat 4 files changed, 80 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Thu Jun 12 11:01:40 2014 -0700
+++ b/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Fri Jun 13 09:11:54 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/test/sun/text/resources/Format/Bug8037343.java	Fri Jun 13 09:11:54 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/test/sun/text/resources/LocaleData	Thu Jun 12 11:01:40 2014 -0700
+++ b/test/sun/text/resources/LocaleData	Fri Jun 13 09:11:54 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=,
@@ -7695,3 +7695,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/test/sun/text/resources/LocaleDataTest.java	Thu Jun 12 11:01:40 2014 -0700
+++ b/test/sun/text/resources/LocaleDataTest.java	Fri Jun 13 09:11:54 2014 -0700
@@ -36,7 +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 7090826
- *      8017142
+ *      8017142 8037343
  * @summary Verify locale data
  *
  */