You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/04/27 12:29:52 UTC

svn commit: r768920 - /harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java

Author: tellison
Date: Mon Apr 27 10:29:52 2009
New Revision: 768920

URL: http://svn.apache.org/viewvc?rev=768920&view=rev
Log:
Apply slightly modified patch for HARMONY-6181 ([classlib][text] SimpleDateFormatTest.test_set2DigitYearStartLjava_util_Date would fail)

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java

Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java?rev=768920&r1=768919&r2=768920&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java Mon Apr 27 10:29:52 2009
@@ -257,8 +257,19 @@
      * @exception IllegalArgumentException
      *                if the pattern is invalid
      */
+    @SuppressWarnings("nls")
     public void applyPattern(String template) {
         validatePattern(template);
+        /*
+         * ICU spec explicitly mentions that "ICU interprets a single 'y'
+         * differently than Java." We need to do a trick here to follow Java
+         * spec.
+         */
+        if (template.equals("y")) {
+            icuFormat.applyPattern("yy");
+            pattern = "y";
+            return;
+        }
         icuFormat.applyPattern(template);
         pattern = template;
     }