JDK 9 RFR of 8030814: Long.parseUnsignedLong should throw exception on too large input

Paul Sandoz paul.sandoz at oracle.com
Thu Jan 9 09:48:17 UTC 2014

Hi Brian,

This generally looks good, rather clever trick, i prefer it to using a cache.

I agree with Joe some comments are required as it is not immediately obvious how this works.

The additional tests seem adequate (overflow of the overflow), it's easy to go overboard e.g. you could test:

  BigInteger b = quotient.multiply(BigInteger.valueOf(radix + N));

for some range of N according to the radix under test. However, it might be useful to accurately test boundary conditions.


On Jan 3, 2014, at 8:00 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

> Issue:	https://bugs.openjdk.java.net/browse/JDK-8030814
> webrev:	http://cr.openjdk.java.net/~bpb/8030814/webrev.2/
> This review request follows from the discussion of last month in this thread:
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-December/024031.html
> The contributed patch before my minor tweaking of it is here
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-December/024110.html
> with a detailed explanation of its logic here
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-December/024136.html
> I added to the java/lang/Long/Unsigned JTREG test the case from the issue report as well as some other cases which exercise both sides of the A v B overflow test.
> Thanks,
> Brian

More information about the core-libs-dev mailing list