Menu

#361 BigIntegerDataType not handling null value correctly, NullPointerException

v2.5.*
closed-fixed
None
2.5.1
9
2014-11-29
2014-10-29
Driss Amri
No

There seems to be a NullPointerException in the BigIntegerDataType class. On https://sourceforge.net/p/dbunit/code.git/ci/master/tree/dbunit/src/main/java/org/dbunit/dataset/datatype/BigIntegerDataType.java#l115 the typeCast method handles null values well, no problems there.

But on the next line a BigDecimal is made from a (BigInteger) null value and this is where it goes wrong. The constructor makes a call to compactValFor(BigInteger b) and it is not able to handle null values.

This behaviour is quickly verified with a simple test case:
@Test
public void test(){
BigInteger val = null;
new BigDecimal(val);
}

This is necessary for us since we are trying to insert a null value for a optional foreign key.

Discussion

  • Jeff Jensen

    Jeff Jensen - 2014-11-29
    • status: open --> closed-fixed
    • assigned_to: Jeff Jensen
    • Fixed Release: (not fixed) --> 2.5.1
     
  • Jeff Jensen

    Jeff Jensen - 2014-11-29

    Thanks for diagnosing the problem location.

     

Log in to post a comment.