RFR: 8264161: BigDecimal#stripTrailingZeros can throw undocumented ArithmeticException

Dalibor Topic robilad at openjdk.java.net
Wed Apr 21 15:40:53 UTC 2021

On Thu, 25 Mar 2021 08:19:24 GMT, Fabian Meumertzheim <github.com+4312191+fmeum at openjdk.org> wrote:

> Adds missing @throws declarations for ArithmeticException to the public
> function
> java.math.BigDecimal#stripTrailingZeros
> as well as the private helper functions
> java.math.BigDecimal#createAndStripZerosToMatchScale(long, int, long)
> java.math.BigDecimal#createAndStripZerosToMatchScale(BigInteger, int, long)
> stripTrailingZeros calls one of the two helper functions, both of which
> can repeatedly decrease the scale by 1 until it underflows. If it does,
> the call to checkScale will result in an ArithmeticException (overflow).

Hi, please send me an e-mail at Dalibor.topic at oracle.com so that I can verify your account.


PR: https://git.openjdk.java.net/jdk/pull/3189

More information about the core-libs-dev mailing list