harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r554847 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/GregorianCalendar.java test/api/common/tests/api/java/util/CalendarTest.java
Date Tue, 10 Jul 2007 06:31:11 GMT
Author: tonywu
Date: Mon Jul  9 23:31:10 2007
New Revision: 554847

URL: http://svn.apache.org/viewvc?view=rev&rev=554847
Log:
Fix HARMONY-4384 ([classlib][luni] Losing Calendar.set(...) settings during consecutive set(...)
calls)

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java?view=diff&rev=554847&r1=554846&r2=554847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
Mon Jul  9 23:31:10 2007
@@ -694,6 +694,9 @@
                                         - (days + daysInMonth(leapYear, month) - 3))
                                 + fields[DAY_OF_WEEK_IN_MONTH] * 7;
                     }
+                } else if (isSet[DAY_OF_WEEK]) {
+                    int skew = mod7(days - 3 - (getFirstDayOfWeek() - 1));
+                    days += mod7(mod7(skew + dayOfWeek - (days - 3)) - skew);
                 }
             }
         } else {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/CalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/CalendarTest.java?view=diff&rev=554847&r1=554846&r2=554847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/CalendarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/CalendarTest.java
Mon Jul  9 23:31:10 2007
@@ -142,6 +142,15 @@
 		cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
 		assertTrue("Incorrect result 1b: " + cal.getTime(), cal.getTime()
 				.getTime() == 1015822800000L);
+        // Regression for HARMONY-4384
+        // Set DAY_OF_WEEK without DATE
+        cal.clear();
+        cal.set(Calendar.YEAR, 2002);
+        cal.set(Calendar.MONTH, Calendar.MARCH);
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
+        assertEquals("Incorrect result 1b: " + cal.getTime(), 1015304400000L, cal.getTime()
+                .getTime());
+        
 
 		// WEEK_OF_MONTH has priority
 		cal.clear();



Mime
View raw message