Integrated: 8155191: Specify that SecureRandom.nextBytes(byte[]) throws NullPointerException when byte array is null

Valerie Peng valeriep at openjdk.org
Fri May 12 23:03:00 UTC 2023


On Thu, 4 May 2023 01:58:42 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

> Just a trivial change for enforcing consistent NullPointerException behavior for the SecureRandom.nextBytes(byte[]) method.
> 
> Other similar methods such as Random.nextByte(byte[]) and its other subclasses all throw NPE for null byte[] argument. Most JDK default providers' SecureRandom impls also check and throw NPE. Thus, this should be moved up and enforced by the SecureRandom class to ensure consistency.
> 
> CSR has been filed.
> 
> Thanks,
> Valerie

This pull request has now been integrated.

Changeset: 46e3d24a
Author:    Valerie Peng <valeriep at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/46e3d24a6ff7d52d11f441d92628669d86d8bfaf
Stats:     104 lines in 4 files changed: 90 ins; 7 del; 7 mod

8155191: Specify that SecureRandom.nextBytes(byte[]) throws NullPointerException when byte array is null

Reviewed-by: mullan

-------------

PR: https://git.openjdk.org/jdk/pull/13788



More information about the security-dev mailing list