Skip to content

Commit

Permalink
8220483: Calendar.setTime(Date date) throws NPE with Date date = null
Browse files Browse the repository at this point in the history
Reviewed-by: lancea, joehw
  • Loading branch information
naotoj committed Sep 15, 2020
1 parent 65bfe09 commit 57f92d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/java.base/share/classes/java/util/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

1 comment on commit 57f92d2

@bridgekeeper
Copy link

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.