Skip to content

Commit 57f92d2

Browse files
committedSep 15, 2020
8220483: Calendar.setTime(Date date) throws NPE with Date date = null
Reviewed-by: lancea, joehw
1 parent 65bfe09 commit 57f92d2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎src/java.base/share/classes/java/util/Calendar.java

+2
Original file line numberDiff line numberDiff line change
@@ -1796,8 +1796,10 @@ public final Date getTime() {
17961796
* @param date the given Date.
17971797
* @see #getTime()
17981798
* @see #setTimeInMillis(long)
1799+
* @throws NullPointerException if {@code date} is {@code null}
17991800
*/
18001801
public final void setTime(Date date) {
1802+
Objects.requireNonNull(date, "date must not be null");
18011803
setTimeInMillis(date.getTime());
18021804
}
18031805

0 commit comments

Comments
 (0)
Please sign in to comment.