harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r432324 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/GregorianCalendar.java test/java/tests/api/java/util/CalendarTest.java
Date Thu, 17 Aug 2006 18:31:37 GMT
Author: tellison
Date: Thu Aug 17 11:31:36 2006
New Revision: 432324

URL: http://svn.apache.org/viewvc?rev=432324&view=rev
Log:
Apply patch HARMONY-923 (Incorrect dates in java.util.Calendar() when year is very large)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.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/GregorianCalendar.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java?rev=432324&r1=432323&r2=432324&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/GregorianCalendar.java
Thu Aug 17 11:31:36 2006
@@ -755,7 +755,9 @@
 		return (int) days + 1;
 	}
 
-	private long daysFromBaseYear(int year) {
+	private long daysFromBaseYear(int iyear) {
+                long year = iyear;
+
 		if (year >= 1970) {
 			long days = (year - 1970) * (long) 365 + ((year - 1969) / 4);
 			if (year > changeYear) {

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?rev=432324&r1=432323&r2=432324&view=diff
==============================================================================
--- 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
Thu Aug 17 11:31:36 2006
@@ -432,6 +432,25 @@
                 .getTimeZone());
     }
 
+    /**
+     * @tests java.util.Calendar#getTimeInMillis()
+     */
+    public void test_getTimeInMillis() {
+        Calendar cal = Calendar.getInstance();
+
+        int year = Integer.MIN_VALUE + 71;
+        cal.setTimeZone(TimeZone.getTimeZone("GMT"));;
+        cal.set(Calendar.YEAR, year + 1900);
+        cal.set(Calendar.MONTH, Calendar.JANUARY);
+        cal.set(Calendar.DATE, 1);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+
+        assertEquals(cal.getTimeInMillis(), 6017546357372606464L);
+    }
+
 	protected void setUp() {
 		defaultLocale = Locale.getDefault();
 		Locale.setDefault(Locale.US);



Mime
View raw message