Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#22 NPE in MockResultSet.isRowEqual()

closed
Alwin Ibba
None
5
2007-08-01
2007-02-13
Nigel Charman
No

When calling MockResultSet.isRowEqual(int number, List rowData) with a row that contain a null column, a NullPointerException is thrown on the following line:

if(!source.getClass().isAssignableFrom(target.getClass()) && target.getClass().isAssignableFrom(source.getClass()))

The fix appears to be to change the line to:

if(source != null && target != null &&
!source.getClass().isAssignableFrom(target.getClass()) &&
!target.getClass().isAssignableFrom(source.getClass()))

This skips the assigning to string, and ParameterUtils.compareParameter() correctly compares the null values.

This fix works for the code where I found the problem.

Discussion

  • Alwin Ibba
    Alwin Ibba
    2007-02-13

    Logged In: YES
    user_id=804648
    Originator: NO

    Yes this is a bug. Thanks. I'll fix it using your suggestion (which should also applied to isColumnEqual()).

     
  • Alwin Ibba
    Alwin Ibba
    2007-02-13

    • assigned_to: nobody --> aibba
     
  • Alwin Ibba
    Alwin Ibba
    2007-08-01

    • status: open --> closed