- 
    Bug 
- 
    Resolution: Fixed
- 
     P2 P2
- 
    6u14
- 
        b03
- 
        generic
- 
        generic
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-2173288 | 7 | Xiaobin Lu | P3 | Closed | Fixed | b62 | 
                    BigDecimal.longValueExact() method throws NullpointerException with 6u14-b01 build.
Following testcase could be used to reproduce the issue.
<Code>
import java.math.BigDecimal;
class BigDecimalTest
{
public static void main(String... args){
try {
String longValue = "9223372036854775807.0";
BigDecimal bd = new BigDecimal(longValue);
long longvalue= bd.longValue();
long longValueExact = bd.longValueExact();
System.out.println("Test passed ");
} catch(ArithmeticException e) {
System.out.println("Test failed ");
e.printStackTrace();
}
}
}
</Code>
<Output>
Exception in thread "main" java.lang.NullPointerException
at java.math.BigDecimal$LongOverflow.check(BigDecimal.java:2974)
at java.math.BigDecimal.longValueExact(BigDecimal.java:2962)
at BigDecimalTest.main(BigDecimalTest.java:9)
</Output>
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b01)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode)
This test passes with the 6u12-b04 promoted build. Fix for the bug 6622432 may have caused this regression.
            
Following testcase could be used to reproduce the issue.
<Code>
import java.math.BigDecimal;
class BigDecimalTest
{
public static void main(String... args){
try {
String longValue = "9223372036854775807.0";
BigDecimal bd = new BigDecimal(longValue);
long longvalue= bd.longValue();
long longValueExact = bd.longValueExact();
System.out.println("Test passed ");
} catch(ArithmeticException e) {
System.out.println("Test failed ");
e.printStackTrace();
}
}
}
</Code>
<Output>
Exception in thread "main" java.lang.NullPointerException
at java.math.BigDecimal$LongOverflow.check(BigDecimal.java:2974)
at java.math.BigDecimal.longValueExact(BigDecimal.java:2962)
at BigDecimalTest.main(BigDecimalTest.java:9)
</Output>
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b01)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode)
This test passes with the 6u12-b04 promoted build. Fix for the bug 6622432 may have caused this regression.
- backported by
- 
                    JDK-2173288 BigDecimal.longValueExact() method throws NullPointerException -           
- Closed
 
-         
- relates to
- 
                    JDK-6876282 BigDecimal's divide(BigDecimal bd, RoundingFormat r) produces incorrect result -           
- Closed
 
-         
- 
                    JDK-6622432 RFE: Performance improvements to java.math.BigDecimal -           
- Resolved
 
-