8174950: Gracefully handle null Supplier in Objects.requireNonNull
Reviewed-by: dholmes, psandoz, alanb, chegar
This commit is contained in:
parent
cb48e2096d
commit
46cd380010
@ -343,7 +343,8 @@ public final class Objects {
|
||||
*/
|
||||
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) {
|
||||
if (obj == null)
|
||||
throw new NullPointerException(messageSupplier.get());
|
||||
throw new NullPointerException(messageSupplier == null ?
|
||||
null : messageSupplier.get());
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user