This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.text.SimpleDateFormat merge from classpath
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 25 Sep 2003 19:27:41 +0200
- Subject: FYI: Patch: java.text.SimpleDateFormat merge from classpath
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi list,
I commited the attached patch to trunk to merge
java.text.SimpleDateFormat with classpath again.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/cyWNWSOgCCdjSDsRAqJjAJwMPnxoQ8dmPx+/1OKmxCV8E1FfdACgom+j
FmhhS5veqFPiGNOCJVdzJ3o=
=j2Ng
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2183
diff -u -b -B -r1.2183 ChangeLog
--- ChangeLog 25 Sep 2003 17:09:21 -0000 1.2183
+++ ChangeLog 25 Sep 2003 17:23:07 -0000
@@ -1,3 +1,8 @@
+2003-09-25 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/text/SimpleDateFormat.java (parse): Don't use class calendar
+ field.
+
2003-09-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.19
diff -u -b -B -r1.19 SimpleDateFormat.java
--- java/text/SimpleDateFormat.java 24 Jul 2003 15:43:04 -0000 1.19
+++ java/text/SimpleDateFormat.java 25 Sep 2003 17:23:07 -0000
@@ -547,8 +547,9 @@
{
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 @@
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 @@
}
// 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 @@
{
// 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)
{