mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8220483: Calendar.setTime(Date date) throws NPE with Date date = null
Reviewed-by: lancea, joehw
This commit is contained in:
parent
65bfe0928a
commit
57f92d23b1
1 changed files with 2 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue