Commit f6b17867 by Bryce McKinlay Committed by Bryce McKinlay

SimpleDateFormat (parse): Revert patch of 2003-09-25.

	* java/text/SimpleDateFormat (parse): Revert patch of 2003-09-25.
	Don't call setTimeZone on calendar.

From-SVN: r71870
parent 5a36731a
2003-09-28 Bryce McKinlay <bryce@mckinlay.net.nz>
* java/text/SimpleDateFormat (parse): Revert patch of 2003-09-25.
Don't call setTimeZone on calendar.
2003-09-27 Michael Koch <konqueror@gmx.de> 2003-09-27 Michael Koch <konqueror@gmx.de>
* java/net/URL.java (getURLStreamHandler): Compile fixes. * java/net/URL.java (getURLStreamHandler): Compile fixes.
......
...@@ -547,9 +547,8 @@ public class SimpleDateFormat extends DateFormat ...@@ -547,9 +547,8 @@ public class SimpleDateFormat extends DateFormat
{ {
int fmt_index = 0; int fmt_index = 0;
int fmt_max = pattern.length(); int fmt_max = pattern.length();
Calendar loc_calendar = (Calendar)calendar.clone();
loc_calendar.clear(); calendar.clear();
boolean saw_timezone = false; boolean saw_timezone = false;
int quote_start = -1; int quote_start = -1;
boolean is2DigitYear = false; boolean is2DigitYear = false;
...@@ -697,8 +696,7 @@ public class SimpleDateFormat extends DateFormat ...@@ -697,8 +696,7 @@ public class SimpleDateFormat extends DateFormat
found_zone = true; found_zone = true;
saw_timezone = true; saw_timezone = true;
TimeZone tz = TimeZone.getTimeZone (strings[0]); TimeZone tz = TimeZone.getTimeZone (strings[0]);
loc_calendar.setTimeZone (tz); calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
loc_calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
offset = 0; offset = 0;
if (k > 2 && tz instanceof SimpleTimeZone) if (k > 2 && tz instanceof SimpleTimeZone)
{ {
...@@ -765,17 +763,17 @@ public class SimpleDateFormat extends DateFormat ...@@ -765,17 +763,17 @@ public class SimpleDateFormat extends DateFormat
} }
// Assign the value and move on. // Assign the value and move on.
loc_calendar.set(calendar_field, value); calendar.set(calendar_field, value);
} }
if (is2DigitYear) if (is2DigitYear)
{ {
// Apply the 80-20 heuristic to dermine the full year based on // Apply the 80-20 heuristic to dermine the full year based on
// defaultCenturyStart. // defaultCenturyStart.
int year = defaultCentury + loc_calendar.get(Calendar.YEAR); int year = defaultCentury + calendar.get(Calendar.YEAR);
loc_calendar.set(Calendar.YEAR, year); calendar.set(Calendar.YEAR, year);
if (loc_calendar.getTime().compareTo(defaultCenturyStart) < 0) if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
loc_calendar.set(Calendar.YEAR, year + 100); calendar.set(Calendar.YEAR, year + 100);
} }
try try
...@@ -784,10 +782,10 @@ public class SimpleDateFormat extends DateFormat ...@@ -784,10 +782,10 @@ public class SimpleDateFormat extends DateFormat
{ {
// Use the real rules to determine whether or not this // Use the real rules to determine whether or not this
// particular time is in daylight savings. // particular time is in daylight savings.
loc_calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.DST_OFFSET);
loc_calendar.clear (Calendar.ZONE_OFFSET); calendar.clear (Calendar.ZONE_OFFSET);
} }
return loc_calendar.getTime(); return calendar.getTime();
} }
catch (IllegalArgumentException x) catch (IllegalArgumentException x)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment