harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r558942 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/GregorianCalendar.java test/api/common/tests/api/java/util/GregorianCalendarTest.java
Date Tue, 24 Jul 2007 07:08:31 GMT
Author: tonywu
Date: Tue Jul 24 00:08:30 2007
New Revision: 558942

URL: http://svn.apache.org/viewvc?view=rev&rev=558942
Log:
Fix Harmony-4513 ([classlib][luni] Wrong value for DAY_OF_MONTH at Gregorian cutover date)

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/GregorianCalendarTest.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=558942&r1=558941&r2=558942
==============================================================================
--- 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
Tue Jul 24 00:08:30 2007
@@ -330,7 +330,7 @@
 
         int dayOfYear = computeYearAndDay(days, timeVal + zoneOffset);
         fields[DAY_OF_YEAR] = dayOfYear;
-        if(fields[YEAR] == changeYear && gregorianCutover < timeVal + zoneOffset){
+        if(fields[YEAR] == changeYear && gregorianCutover <= timeVal + zoneOffset){
             dayOfYear += currentYearSkew;
         }
         int month = dayOfYear / 32;
@@ -361,7 +361,7 @@
                 dayOfYear = computeYearAndDay(days, timeVal - zoneOffset
                         + dstOffset);
                 fields[DAY_OF_YEAR] = dayOfYear;
-                if(fields[YEAR] == changeYear && gregorianCutover < timeVal -
zoneOffset + dstOffset){
+                if(fields[YEAR] == changeYear && gregorianCutover <= timeVal -
zoneOffset + dstOffset){
                     dayOfYear += currentYearSkew;
                 }
                 month = dayOfYear / 32;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java?view=diff&rev=558942&r1=558941&r2=558942
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/GregorianCalendarTest.java
Tue Jul 24 00:08:30 2007
@@ -724,6 +724,17 @@
         gc.setTimeInMillis(Date.parse("Dec 1 00:00:01 GMT 2000"));
         assertEquals(1, gc.get(Calendar.DAY_OF_MONTH));
         assertEquals(11, gc.get(Calendar.MONTH));
+        
+        // Regression test for HARMONY-4513
+        gc = new GregorianCalendar(1582, Calendar.OCTOBER, 15);
+        assertEquals(1582, gc.get(Calendar.YEAR));
+        assertEquals(Calendar.OCTOBER, gc.get(Calendar.MONTH));
+        assertEquals(15, gc.get(Calendar.DAY_OF_MONTH));
+        assertEquals(0, gc.get(Calendar.HOUR_OF_DAY));
+        assertEquals(0, gc.get(Calendar.MINUTE));
+        assertEquals(0, gc.get(Calendar.SECOND));
+        gc = new GregorianCalendar(1582, Calendar.OCTOBER, 14);
+        assertEquals(24, gc.get(Calendar.DAY_OF_MONTH));
     }
 
 	/**



Mime
View raw message