Buggy code:
public int getUpdateAction ( ) { } public void setUpdateAction ( int action ) { } public int getIndex ( ) { } void setIndex ( int index ) { } public Column getPrimaryKeyColumn ( Column local ) { } public Column getColumn ( Column pk ) { } public Object getConstant ( Column local ) { } public Object getPrimaryKeyConstant ( Column pk ) { } public Column [ ] getColumns ( ) { } public Object [ ] getConstants ( ) { } public Object [ ] getPrimaryKeyConstants ( ) { } public boolean containsColumn ( Column col ) { } public boolean containsPrimaryKeyColumn ( Column col ) { } public boolean containsConstantColumn ( Column col ) { } public boolean containsConstantPrimaryKeyColumn ( Column col ) { } public Column [ ] getPrimaryKeyColumns ( ) { } public Column [ ] getConstantColumns ( ) { } public Column [ ] getConstantPrimaryKeyColumns ( ) { } public void setJoins ( Column [ ] cols , Column [ ] pkCols ) { } public void setConstantJoins ( Object [ ] consts , Column [ ] pkCols ) { } public void setConstantJoins ( Column [ ] cols , Object [ ] consts ) { } public void join ( Column local , Column toPK ) { } public void joinConstant ( Object val , Column toPK ) { } public void joinConstant ( Column col , Object val ) { } public boolean removeJoin ( Column col ) { } public Table getPrimaryKeyTable ( ) { } public void refColumns ( ) { } public void derefColumns ( ) { } public boolean equalsForeignKey ( ForeignKey fk ) { } public boolean columnsMatch ( Column [ ] fkCols , Column [ ] fkPKCols ) { } public boolean hasNotNullColumns ( ) { } private static boolean match ( Column [ ] cols , Column [ ] fkCols ) { } private static boolean hasColumn ( Column [ ] cols , Column col ) { } private static boolean match ( Object [ ] vals , Object [ ] fkVals ) { } public String loadNameFromDB ( DBDictionary dbdict , Connection conn ) { } public DBIdentifier loadIdentifierFromDB ( DBDictionary dbdict , Connection conn ) { if ( ( isLogical ( ) ) || ( ( getTable ( ) ) == null ) ) return DBIdentifier . NULL ; DBIdentifier retVal = DBIdentifier . NULL ; try { Schema schema = getTable ( ) . getSchema ( ) ; ForeignKey [ ] fks = dbdict . getImportedKeys ( conn . getMetaData ( ) , DBIdentifier . newCatalog ( conn . getCatalog ( ) ) , schema . getIdentifier ( ) , getTable ( ) . getIdentifier ( ) , conn , false ) ; for ( int i = 0 ; i < ( fks . length ) ; i ++ ) { Table localtable = schema . getTable ( fks [ i ] . getTableIdentifier ( ) ) ; Table pkTable = schema . getTable ( fks [ i ] . getPrimaryKeyTableIdentifier ( ) ) ; boolean addFK = false ; ForeignKey fkTemp = localtable . getForeignKey ( fks [ i ] . getIdentifier ( ) ) ; if ( fkTemp == null ) { addFK = true ; fkTemp = localtable . addForeignKey ( fks [ i ] . getIdentifier ( ) ) ; fkTemp . setDeferred ( fks [ i ] . isDeferred ( ) ) ; fkTemp . setDeleteAction ( fks [ i ] . getDeleteAction ( ) ) ; } if ( ( ( fks [ i ] . getColumns ( ) ) == null ) || ( ( fks [ i ] . getColumns ( ) . length ) == 0 ) ) { if ( ! ( fkTemp . containsColumn ( localtable . getColumn ( fks [ i ] . getColumnIdentifier ( ) ) ) ) ) fkTemp . join ( localtable . getColumn ( fks [ i ] . getColumnIdentifier ( ) ) , pkTable . getColumn ( fks [ i ] . getPrimaryKeyColumnIdentifier ( ) ) ) ; } else { Column [ ] locCols = fks [ i ] . getColumns ( ) ; Column [ ] pkCols = fks [ i ] . getPrimaryKeyColumns ( ) ; <START_BUG> if ( ( locCols != null ) && ( ( pkCols != null ) & ( ( locCols . length ) != ( pkCols . length ) ) ) ) { <END_BUG> Log log = dbdict . getLog ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( ForeignKey . _loc . get ( "fk-column-mismatch" ) ) ; } } for ( int j = 0 ; j < ( locCols . length ) ; j ++ ) { if ( ! ( fkTemp . containsColumn ( localtable . getColumn ( locCols [ j ] . getIdentifier ( ) ) ) ) ) { fkTemp . join ( localtable . getColumn ( locCols [ j ] . getIdentifier ( ) ) , pkTable . getColumn ( pkCols [ j ] . getIdentifier ( ) ) ) ; } } } if ( equalsForeignKey ( fkTemp ) ) { if ( addFK ) localtable . removeForeignKey ( fkTemp ) ; retVal = fks [ i ] . getIdentifier ( ) ; break ; } if ( addFK ) localtable . removeForeignKey ( fkTemp ) ; } } catch ( Exception ex ) { Log log = dbdict . getLog ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( ForeignKey . _loc . get ( "except-read-fk-name" ) , ex ) ; } } return retVal ; } public void addColumn ( ForeignKey fk ) { } private static Column [ ] createKeyColumns ( ForeignKey fk ) { } public static class FKMapKey { private ForeignKey _fk ; public FKMapKey ( ForeignKey fk ) { }

Fix:
if ( ( ( locCols != null ) && ( pkCols != null ) ) && ( ( locCols . length ) != ( pkCols . length ) ) ) {