8215759: java/math/BigInteger/ModPow.java can throw an ArithmeticException

Stuart Marks stuart.marks at oracle.com
Fri Dec 21 19:49:03 UTC 2018

On 12/21/18 8:36 AM, Brian Burkhalter wrote:
> I updated the test to use RandomFactory:
> http://cr.openjdk.java.net/~bpb/8215759/webrev.01/

Oddly enough, changing this to use RandomFactory instead of the fixed seed makes 
it MORE likely that the random modulus will be zero. But this is OK, since your 
original change prevents zero from occurring.

Even if this test were to continue to use a fixed seed, I'd still be in favor of 
the change that prevents zero from occurring. Even though that couldn't happen 
in the original test, it would be a possibility if the source of randomness were 
changed in future maintenance and that maintainer didn't notice that zero would 
result in an error.

In any case, the change looks fine.


More information about the core-libs-dev mailing list