Menu

#102 NPE In InsertIdentityOperation

closed
nobody
Bug (232)
5
2008-06-14
2005-10-17
No

InsertIdentityOperation.hasIdentityColumn has incorrect
code which causes an NPE if you attempt to query the
table name; it should be:

private boolean hasIdentityColumn(ITableMetaData metaData,
IDatabaseConnection connection)
throws DataSetException
{
DatabaseConfig config = connection.getConfig();
IColumnFilter identityFilter = (IColumnFilter)
config.getProperty(
PROPERTY_IDENTITY_COLUMN_FILTER);
if (identityFilter == null)
{
identityFilter = DEFAULT_IDENTITY_FILTER;
}

// Verify if there is at least one identity column
Column[] columns = metaData.getColumns();
for (int i = 0; i < columns.length; i++)
{
if
(identityFilter.accept(metaData.getTableName(),
columns[i]))
{
return true;
}
}

return false;
}

The fix is on the if (identityFilter.accept(... ) line.

Discussion

  • Eric Pugh

    Eric Pugh - 2005-10-18

    Logged In: YES
    user_id=140549

    Okay, looking at this, the change is from a null being passed in to
    metaData.getTableName(), correct? Please review the fix I committed.
    In the future, please supply a "patch" file as that can be automatically
    applied.

     
  • Roberto Lo Giacco

    • status: open --> closed
     
  • Roberto Lo Giacco

    Logged In: YES
    user_id=57511
    Originator: NO

    closed as already patched

     
  • Roberto Lo Giacco

    • labels: --> Bug
     

Log in to post a comment.