harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r484807 - in /harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/ test/java/org/apache/harmony/text/tests/java/text/
Date Fri, 08 Dec 2006 21:50:21 GMT
Author: tellison
Date: Fri Dec  8 13:50:20 2006
New Revision: 484807

URL: http://svn.apache.org/viewvc?view=rev&rev=484807
Log:
Apply patch for HARMONY-1875 ([classlib][text] java.text.MessageFormat.format(Object) rerurns
result different from RI)

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/SimpleDateFormat.java
    harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
    harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.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?view=diff&rev=484807&r1=484806&r2=484807
==============================================================================
--- 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
Fri Dec  8 13:50:20 2006
@@ -158,7 +158,7 @@
                 if (count < 4) {
                     appendNumber(buffer, 2, year %= 100);
                 } else {
-                    appendNumber(buffer, 4, year);
+                    appendNumber(buffer, count, year);
                 }
                 break;
             case MONTH_FIELD:

Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?view=diff&rev=484807&r1=484806&r2=484807
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
Fri Dec  8 13:50:20 2006
@@ -35,6 +35,7 @@
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.Locale;
+import java.util.TimeZone;
 
 import junit.framework.TestCase;
 import tests.support.Support_MessageFormat;
@@ -757,5 +758,15 @@
 		Object[] res = mf.parse("1,00,00");
 		assertEquals("Assert 0: incorrect size of parsed data ", 1, res.length);
 		assertEquals("Assert 1: parsed value incorrectly", new Long(10000), (Long)res[0]);
-	} 
+	}
+	public void test_format_Object() { 
+		// Regression for HARMONY-1875
+        Locale.setDefault(Locale.CANADA); 
+        TimeZone.setDefault(TimeZone.getTimeZone("UTC")); 
+        String pat="text here {0, date, yyyyyyyyy } and here"; 
+        String etalon="text here 000002006 and here"; 
+        MessageFormat obj = new MessageFormat(pat); 
+        assertEquals(etalon, obj.format(new Object[]{new Date((new Date().getTime()))}));

+    } 
+
 }

Modified: harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?view=diff&rev=484807&r1=484806&r2=484807
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
Fri Dec  8 13:50:20 2006
@@ -362,7 +362,7 @@
                 DateFormat.YEAR_FIELD);
         test.test(" yyy", cal, " 99", DateFormat.YEAR_FIELD);
         test.test(" yyyy", cal, " 1999", DateFormat.YEAR_FIELD);
-        test.test(" yyyyy", cal, " 1999", DateFormat.YEAR_FIELD);
+        test.test(" yyyyy", cal, " 01999", DateFormat.YEAR_FIELD);
 
         test.test(" M", cal, " 6", DateFormat.MONTH_FIELD);
         test.test(" M", new GregorianCalendar(1999, Calendar.NOVEMBER, 2),



Mime
View raw message