harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r475335 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Calendar.java test/java/tests/api/java/util/CalendarTest.java
Date Wed, 15 Nov 2006 17:58:17 GMT
Author: pyang
Date: Wed Nov 15 09:58:16 2006
New Revision: 475335

URL: http://svn.apache.org/viewvc?view=rev&rev=475335
Log:
Apply patch for HARMONY-2122 ( [classlib][luni] Calendar incorrectly handle new AM_PM value
setting)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java?view=diff&rev=475335&r1=475334&r2=475335
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Calendar.java
Wed Nov 15 09:58:16 2006
@@ -612,6 +612,9 @@
 		if (field == HOUR || field == HOUR_OF_DAY) {
             lastTimeFieldSet = field;
         }
+        if (field == AM_PM) {
+            lastTimeFieldSet = HOUR;
+        }
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java?view=diff&rev=475335&r1=475334&r2=475335
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
Wed Nov 15 09:58:16 2006
@@ -367,6 +367,14 @@
 				Calendar.PM, cal.get(Calendar.AM_PM));
 		assertEquals(hour, cal.get(Calendar.HOUR));
 		assertEquals(hourOfDay + 12, cal.get(Calendar.HOUR_OF_DAY));
+        
+        // regression test for Harmony-2122
+        cal = Calendar.getInstance();
+        int oldValue = cal.get(Calendar.AM_PM);
+        int newValue = (oldValue == Calendar.AM) ? Calendar.PM : Calendar.AM;
+        cal.set(Calendar.AM_PM, newValue);
+        newValue = cal.get(Calendar.AM_PM);
+        assertTrue(newValue != oldValue);
 	}
 
 	/**



Mime
View raw message