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

Valerie Peng valeriep at openjdk.org
Fri May 5 01:21:32 UTC 2023


> 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

Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:

  Add NPE for SecureRandom(byte[]) ctor and setSeed(byte[]) method.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13788/files
  - new: https://git.openjdk.org/jdk/pull/13788/files/27687285..34ebdfa7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13788&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13788&range=00-01

  Stats: 39 lines in 4 files changed: 32 ins; 3 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/13788.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13788/head:pull/13788

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



More information about the security-dev mailing list