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

Brian Burkhalter brian.burkhalter at oracle.com
Fri Dec 21 20:59:03 UTC 2018


HI Stuart,

> On Dec 21, 2018, at 11:49 AM, Stuart Marks <stuart.marks at oracle.com> wrote:
> 
> 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/ <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.

Right.

> 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.

Thanks,

Brian


More information about the core-libs-dev mailing list