Hi,
On Sat, 2003-09-27 at 22:21, Bryce McKinlay wrote:Can you give me a pointer to the failing mauve test?
Without the patch the following four mauve tests fail: FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: CDT (number 1) FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: EDT (number 1) FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: EST (number 1) FAIL: gnu.testlet.java.text.SimpleDateFormat.regress: PDT (number 1)
Thanks Mark.
The real problem here is that setTimeZone() was being called on the underlying calendar. This is not necessary since the ZONE_OFFSET field has the same effect, without overwriting the timezone which the user set and "sticking" across a calendar.clear() call. The cloning approach only worked by chance, since it reset the calendar's timezone to GMT which just happened to be what the test case expected.
I'm checking in this patch to libgcj & classpath.
Regards
Bryce.
2003-09-28 Bryce McKinlay <[EMAIL PROTECTED]>
* java/text/SimpleDateFormat (parse): Revert patch of 2003-09-25.
Don't call setTimeZone on the calendar.
Index: SimpleDateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.20
diff -u -r1.20 SimpleDateFormat.java
--- SimpleDateFormat.java 25 Sep 2003 17:25:15 -0000 1.20
+++ SimpleDateFormat.java 28 Sep 2003 03:38:05 -0000
@@ -547,9 +547,8 @@
{
int fmt_index = 0;
int fmt_max = pattern.length();
- Calendar loc_calendar = (Calendar)calendar.clone();
- loc_calendar.clear();
+ calendar.clear();
boolean saw_timezone = false;
int quote_start = -1;
boolean is2DigitYear = false;
@@ -697,8 +696,7 @@
found_zone = true;
saw_timezone = true;
TimeZone tz = TimeZone.getTimeZone (strings[0]);
- loc_calendar.setTimeZone (tz);
- loc_calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
+ calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
offset = 0;
if (k > 2 && tz instanceof SimpleTimeZone)
{
@@ -765,17 +763,17 @@
}
// Assign the value and move on.
- loc_calendar.set(calendar_field, value);
+ calendar.set(calendar_field, value);
}
if (is2DigitYear)
{
// Apply the 80-20 heuristic to dermine the full year based on
// defaultCenturyStart.
- int year = defaultCentury + loc_calendar.get(Calendar.YEAR);
- loc_calendar.set(Calendar.YEAR, year);
- if (loc_calendar.getTime().compareTo(defaultCenturyStart) < 0)
- loc_calendar.set(Calendar.YEAR, year + 100);
+ int year = defaultCentury + calendar.get(Calendar.YEAR);
+ calendar.set(Calendar.YEAR, year);
+ if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
+ calendar.set(Calendar.YEAR, year + 100);
}
try
@@ -784,10 +782,10 @@
{
// Use the real rules to determine whether or not this
// particular time is in daylight savings.
- loc_calendar.clear (Calendar.DST_OFFSET);
- loc_calendar.clear (Calendar.ZONE_OFFSET);
+ calendar.clear (Calendar.DST_OFFSET);
+ calendar.clear (Calendar.ZONE_OFFSET);
}
- return loc_calendar.getTime();
+ return calendar.getTime();
}
catch (IllegalArgumentException x)
{
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath

