Skip to content
Permalink
Browse files
8220483: Calendar.setTime(Date date) throws NPE with Date date = null
Reviewed-by: lancea, joehw
  • Loading branch information
naotoj committed Sep 15, 2020
1 parent 65bfe09 commit 57f92d23b1049e7bfc1d54567757713ca1dd0f3c
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/java.base/share/classes/java/util/Calendar.java
@@ -1796,8 +1796,10 @@ public final Date getTime() {
* @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());
}

1 comment on commit 57f92d2

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 57f92d2 Sep 15, 2020

Please sign in to comment.