harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r494822 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/GregorianCalendar.java test/java/tests/api/java/util/GregorianCalendarTest.java
Date Wed, 10 Jan 2007 14:27:08 GMT
Author: tellison
Date: Wed Jan 10 06:27:07 2007
New Revision: 494822

URL: http://svn.apache.org/viewvc?view=rev&rev=494822
Log:
Apply patch HARMONY-2961 ([classlib][luni]not able to instance a GregorianCalendar with TimeZone
whose offset is greater than 24 hours)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/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=494822&r1=494821&r2=494822
==============================================================================
--- 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
Wed Jan 10 06:27:07 2007
@@ -317,10 +317,11 @@
         }
         // Cannot add ZONE_OFFSET to time as it might overflow
         millis += zoneOffset;
-        if (millis < 0) {
+        while (millis < 0) {
             millis += 86400000;
             days--;
-        } else if (millis >= 86400000) {
+        }
+        while (millis >= 86400000) {
             millis -= 86400000;
             days++;
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java?view=diff&rev=494822&r1=494821&r2=494822
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java
Wed Jan 10 06:27:07 2007
@@ -22,6 +22,7 @@
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.Locale;
+import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 import java.util.Vector;
 
@@ -139,6 +140,11 @@
 		// value
 		assertTrue("Incorrect calendar returned",
 				gc1.get(Calendar.HOUR) == ((gc2.get(Calendar.HOUR) + 1) % 12));
+        
+        // Regression test for Haromny-2961
+        SimpleTimeZone timezone = new SimpleTimeZone(-3600 * 24 * 1000 * 2,
+                "GMT");
+        GregorianCalendar gc = new GregorianCalendar(timezone);
 	}
 
 	/**



Mime
View raw message