[kaffe] Bug report: java.text.SimpleDateFormat#parse

Ito Kazumitsu ito.kazumitsu at hidec.co.jp
Mon Jan 24 23:49:04 PST 2005


In message "[kaffe] Bug report: java.text.SimpleDateFormat#parse"
    on 05/01/25, Ito Kazumitsu <ito.kazumitsu at hidec.co.jp> writes:

> You might have found that test/regression/DateFormatTest.java fails
> recently.
> 
> This is becuase of a bug in java.text.SimpleDateFormat#parse.

And this is my patch.  I am afraid whether or not this patch
is applied,  there may be cases where java.text.SimpleDateFormat#parse
does not handle DST correctly,  but this patch will work fine at least
for those time zones which does not have DST.

--- java/text/SimpleDateFormat.java.orig	Tue Jan 25 14:50:18 2005
+++ java/text/SimpleDateFormat.java	Tue Jan 25 16:35:03 2005
@@ -840,7 +840,7 @@
 		// We need a special case for the timezone, because it
 		// uses a different data structure than the other cases.
 		is_numeric = false;
-		calendar_field = Calendar.DST_OFFSET;
+		calendar_field = Calendar.ZONE_OFFSET;
 		String[][] zoneStrings = formatData.getZoneStrings();
 		int zoneCount = zoneStrings.length;
 		int index = pos.getIndex();
@@ -868,8 +868,8 @@
 			    found_zone = true;
 			    saw_timezone = true;
 			    TimeZone tz = TimeZone.getTimeZone (strings[0]);
-			    calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
-			    offset = tz.getDSTSavings();
+			    calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings());
+			    offset = tz.getRawOffset ();
 			    pos.setIndex(index + strings[k].length());
 			    break;
 			  }



More information about the kaffe mailing list