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
This commit is contained in:
Bryce McKinlay 2003-09-28 04:23:29 +00:00 committed by Bryce McKinlay
parent f6b17867e4
commit 6fb708633d
3 changed files with 33 additions and 24 deletions

View file

@ -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);
}