8220483: Calendar.setTime(Date date) throws NPE with Date date = null
Reviewed-by: lancea, joehw
This commit is contained in:
parent
65bfe0928a
commit
57f92d23b1
@ -1796,8 +1796,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||||||
* @param date the given Date.
|
* @param date the given Date.
|
||||||
* @see #getTime()
|
* @see #getTime()
|
||||||
* @see #setTimeInMillis(long)
|
* @see #setTimeInMillis(long)
|
||||||
|
* @throws NullPointerException if {@code date} is {@code null}
|
||||||
*/
|
*/
|
||||||
public final void setTime(Date date) {
|
public final void setTime(Date date) {
|
||||||
|
Objects.requireNonNull(date, "date must not be null");
|
||||||
setTimeInMillis(date.getTime());
|
setTimeInMillis(date.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user