FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Fedora Core 5
A DESCRIPTION OF THE PROBLEM :
In 1.5, BigDecimal.setScale(int, int) no longer throws ArithmeticException if the scale parameter is smaller then zero.
It should do so according to the spec, and does so in 1.4.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Testcase given.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An ArithmeticException should be thrown. (Or the spec changed)
ACTUAL -
Returned the results of a division with 10^-scale.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
(new BigDecimal(1.0)).setScale(-10, BigDecimal.ROUND_DOWN);
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Check the parameters yourself before calling setScale.