|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
OPERATING SYSTEM(S):
Windows XP
FULL JDK VERSION(S):
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode)
DESCRIPTION:
checkScale allows a value of 2147483647 for the scale but when this
is passed into tenToThe, a new char array is created with a size one
larger 'new char[n + 1]' which causes the exception.
import java.math.BigDecimal;
public class d108737 {
public static void main(String[] args) {
BigDecimal.ONE.setScale(Integer.MAX_VALUE);
}
}
- Exact text of any error messages
Output:
Exception in thread "main" java.lang.NegativeArraySizeException
at java.math.BigDecimal.tenToThe(BigDecimal.java:3117)
at java.math.BigDecimal.setScale(BigDecimal.java:2300)
at java.math.BigDecimal.setScale(BigDecimal.java:2348)
at d108737.main(d108737.java:5)
|