[kaffe] CVS kaffe (guilhem): Imported two fixes from GNU Classpath.
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Sun Sep 28 22:58:02 2003
PatchSet 4079
Date: 2003/09/29 05:55:19
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Imported two fixes from GNU Classpath.
Members:
ChangeLog:1.1674->1.1675
libraries/javalib/java/text/DateFormat.java:1.15->1.16
libraries/javalib/java/text/SimpleDateFormat.java:1.25->1.26
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1674 kaffe/ChangeLog:1.1675
--- kaffe/ChangeLog:1.1674 Mon Sep 29 03:05:27 2003
+++ kaffe/ChangeLog Mon Sep 29 05:55:19 2003
@@ -1,3 +1,9 @@
+2003-09-29 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * libraries/javalib/java/text/SimpleDateFormat.java,
+ libraries/javalib/java/text/DateFormat.java: Synch'ed with GNU
+ Classpath.
+
2003-09-29 Dalibor Topic <robilad@kaffe.org>
* libraries/javalib/java/util/zip/GZIPInputStream.java:
@@ -42,6 +48,7 @@
Added prototypes for setupExceptionHandling,
cleanupExceptionHandling.
+>>>>>>> 1.1674
2003-09-28 Guilhem Lavaux <guilhem@kaffe.org>
* libraries/javalib/java/nio/ByteBufferHelper.java: added missing
Index: kaffe/libraries/javalib/java/text/DateFormat.java
diff -u kaffe/libraries/javalib/java/text/DateFormat.java:1.15 kaffe/libraries/javalib/java/text/DateFormat.java:1.16
--- kaffe/libraries/javalib/java/text/DateFormat.java:1.15 Tue Aug 26 15:03:10 2003
+++ kaffe/libraries/javalib/java/text/DateFormat.java Mon Sep 29 05:55:20 2003
@@ -225,6 +225,8 @@
{
if (obj instanceof Number)
obj = new Date(((Number) obj).longValue());
+ else if (! (obj instanceof Date))
+ throw new IllegalArgumentException ("Cannot format given Object as a Date");
return format ((Date) obj, buf, pos);
}
Index: kaffe/libraries/javalib/java/text/SimpleDateFormat.java
diff -u kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.25 kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.26
--- kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.25 Sun Aug 31 23:13:34 2003
+++ kaffe/libraries/javalib/java/text/SimpleDateFormat.java Mon Sep 29 05:55:20 2003
@@ -605,9 +605,8 @@
{
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;
@@ -755,8 +754,7 @@
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)
{
@@ -823,17 +821,17 @@
}
// 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
@@ -842,10 +840,10 @@
{
// 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)
{