RNG-170: Ensure nextBytes is consistent with JDK range checks
authorAlex Herbert <aherbert@apache.org>
Wed, 16 Mar 2022 00:06:47 +0000 (00:06 +0000)
committerAlex Herbert <aherbert@apache.org>
Wed, 16 Mar 2022 00:06:47 +0000 (00:06 +0000)
commitc3c802117da90523ecc0dd1507d895ac9c3f5f54
tree5f19340c6829effd464096e74a5ec67b70274213
parent3ed42d76d5da8787741f4ce57e321cae2a111d4a
RNG-170: Ensure nextBytes is consistent with JDK range checks

Updated to match behaviour of System.arraycopy and JDK 9
Objects.checkFromIndexSize. This now allows:

nextBytes(new byte[0], 0, 0)
nextBytes(new byte[10], 10, 0)

Previously these would throw an exception.
commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/IntProvider.java
commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/LongProvider.java
commons-rng-core/src/test/java/org/apache/commons/rng/core/BaseProviderTest.java
commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/IntProviderTest.java
commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/LongProviderTest.java
src/changes/changes.xml
src/main/resources/spotbugs/spotbugs-exclude-filter.xml