Hi again,
This commit changes the default for DAY_OF_WEEK_IN_MONTH to match
Sun's implementation, and adds a couple of comments explaining
what might otherwise look like odd decisions.
Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.9239.2.3
diff -u -r1.9239.2.3 ChangeLog
--- ChangeLog 13 Apr 2007 08:12:36 -0000 1.9239.2.3
+++ ChangeLog 13 Apr 2007 09:17:23 -0000
@@ -1,3 +1,9 @@
+2007-04-13 Gary Benson <[EMAIL PROTECTED]>
+
+ * java/util/GregorianCalendar.java
+ (setDefaultFields): Change DAY_OF_WEEK_IN_MONTH default,
+ and add some comments.
+
2007-04-13 Gary Benson <[EMAIL PROTECTED]>
* java/util/Calendar.java
Index: java/util/GregorianCalendar.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/GregorianCalendar.java,v
retrieving revision 1.49.4.2
diff -u -r1.49.4.2 GregorianCalendar.java
--- java/util/GregorianCalendar.java 13 Apr 2007 08:12:37 -0000 1.49.4.2
+++ java/util/GregorianCalendar.java 13 Apr 2007 09:17:23 -0000
@@ -500,11 +500,15 @@
*/
private void setDefaultFields()
{
+ // According to the spec DAY_OF_WEEK_IN_MONTH defaults to 1,
+ // but Sun set it to 0 so we do too.
int[] defaults = {
- AD, 1970, JANUARY, 0, 0, 1, 0, -1, 1, AM, 0, 0, 0, 0, 0, 0, 0
+ AD, 1970, JANUARY, 0, 0, 1, 0, -1, 0, AM, 0, 0, 0, 0, 0, 0, 0
};
System.arraycopy(defaults, 0, fields, 0, FIELD_COUNT);
fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ // It seems odd that a call to computeTime() should cause
+ // areFieldsSet to become true, but that's what Sun do...
areFieldsSet = true;
}