diff options
| author | Bryce McKinlay <bryce@mckinlay.net.nz> | 2003-09-28 04:23:29 +0000 |
|---|---|---|
| committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2003-09-28 05:23:29 +0100 |
| commit | 6fb708633d529fafe3626c2b1b4d39a9dffe36bd (patch) | |
| tree | 3728a1144a17c242c61fd422cdafe0f0074f4cc0 /libjava/java/text/DateFormat.java | |
| parent | f6b17867e4343c45c23e2fba3cb731bb5c54a540 (diff) | |
DateFormat.java (format): Throw IllegalArgumentException if j' is not a Number or Date instance.
* java/text/DateFormat.java (format): Throw IllegalArgumentException
if j' is not a Number or Date instance.
* java/text/SimpleDateFormat.java (tokens): Make it an ArrayList
instead of Vector.
From-SVN: r71871
Diffstat (limited to 'libjava/java/text/DateFormat.java')
| -rw-r--r-- | libjava/java/text/DateFormat.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java index df2b270e4f3..76bf535577a 100644 --- a/libjava/java/text/DateFormat.java +++ b/libjava/java/text/DateFormat.java @@ -151,6 +151,8 @@ public abstract class DateFormat extends Format implements Cloneable { 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); } |
