8220483: Calendar.setTime(Date date) throws NPE with Date date = null

Reviewed-by: lancea, joehw
This commit is contained in:
Naoto Sato 2020-09-15 22:14:14 +00:00
parent 65bfe0928a
commit 57f92d23b1

View File

@ -1796,8 +1796,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param date the given Date.
* @see #getTime()
* @see #setTimeInMillis(long)
* @throws NullPointerException if {@code date} is {@code null}
*/
public final void setTime(Date date) {
Objects.requireNonNull(date, "date must not be null");
setTimeInMillis(date.getTime());
}