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:
parent
f6b17867e4
commit
6fb708633d
3 changed files with 33 additions and 24 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue