diff options
author | Guilhem Lavaux <guilhem@kaffe.org> | 2003-09-25 17:25:15 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-09-25 17:25:15 +0000 |
commit | cc9556b92431b1e4300338cf3363607c24738cba (patch) | |
tree | 84d608672f762e957ce44f556ecca897570a2a18 /libjava/java/text | |
parent | c5fd8041edf6b962e51e223ceac5a70fdf68150a (diff) | |
download | gcc-cc9556b92431b1e4300338cf3363607c24738cba.zip gcc-cc9556b92431b1e4300338cf3363607c24738cba.tar.gz gcc-cc9556b92431b1e4300338cf3363607c24738cba.tar.bz2 |
SimpleDateFormat.java (parse): Don't use class calendar field.
2003-09-25 Guilhem Lavaux <guilhem@kaffe.org>
* java/text/SimpleDateFormat.java (parse): Don't use class calendar
field.
From-SVN: r71782
Diffstat (limited to 'libjava/java/text')
-rw-r--r-- | libjava/java/text/SimpleDateFormat.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java index b43c6cd..f41a27b 100644 --- a/libjava/java/text/SimpleDateFormat.java +++ b/libjava/java/text/SimpleDateFormat.java @@ -547,8 +547,9 @@ public class SimpleDateFormat extends DateFormat { int fmt_index = 0; int fmt_max = pattern.length(); + Calendar loc_calendar = (Calendar)calendar.clone(); - calendar.clear(); + loc_calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; @@ -696,8 +697,8 @@ public class SimpleDateFormat extends DateFormat found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); - calendar.setTimeZone (tz); - calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ()); + loc_calendar.setTimeZone (tz); + loc_calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ()); offset = 0; if (k > 2 && tz instanceof SimpleTimeZone) { @@ -764,17 +765,17 @@ public class SimpleDateFormat extends DateFormat } // Assign the value and move on. - calendar.set(calendar_field, value); + loc_calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. - int year = defaultCentury + calendar.get(Calendar.YEAR); - calendar.set(Calendar.YEAR, year); - if (calendar.getTime().compareTo(defaultCenturyStart) < 0) - calendar.set(Calendar.YEAR, year + 100); + 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); } try @@ -783,10 +784,10 @@ public class SimpleDateFormat extends DateFormat { // Use the real rules to determine whether or not this // particular time is in daylight savings. - calendar.clear (Calendar.DST_OFFSET); - calendar.clear (Calendar.ZONE_OFFSET); + loc_calendar.clear (Calendar.DST_OFFSET); + loc_calendar.clear (Calendar.ZONE_OFFSET); } - return calendar.getTime(); + return loc_calendar.getTime(); } catch (IllegalArgumentException x) { |