aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@mckinlay.net.nz>2003-09-28 03:57:05 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2003-09-28 04:57:05 +0100
commitf6b17867e4343c45c23e2fba3cb731bb5c54a540 (patch)
tree1f190a9670bb00f14812ffcf46e0fd58cd25a85a
parent5a36731a8d3ab08ccfbb2e3693f5585f50f74bfd (diff)
downloadgcc-f6b17867e4343c45c23e2fba3cb731bb5c54a540.zip
gcc-f6b17867e4343c45c23e2fba3cb731bb5c54a540.tar.gz
gcc-f6b17867e4343c45c23e2fba3cb731bb5c54a540.tar.bz2
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
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/java/text/SimpleDateFormat.java22
2 files changed, 15 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 88c212a..1aa4f49 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+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>
* java/net/URL.java (getURLStreamHandler): Compile fixes.
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
index f41a27b..84bc49b 100644
--- a/libjava/java/text/SimpleDateFormat.java
+++ b/libjava/java/text/SimpleDateFormat.java
@@ -547,9 +547,8 @@ public class SimpleDateFormat extends DateFormat
{
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 @@ public class SimpleDateFormat extends DateFormat
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 @@ public class SimpleDateFormat extends DateFormat
}
// 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 @@ public class SimpleDateFormat extends DateFormat
{
// 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)
{