Program: 167507
Project: 167507
Buggy source:
private void write(ISqlTransaction transaction,List<EntityData> inputRows){
  for (  EntityData inputRow : inputRows) {
    for (    TargetTableDefintion targetTableDefinition : targetTables) {
      if (updateFirst) {
        TargetTable modelTable=targetTableDefinition.getUpdateTable();
        if (modelTable.shouldProcess(inputRow)) {
          List<Object> data=getValues(true,modelTable,inputRow);
          int count=execute(transaction,modelTable.getStatement(),new Object(),data);
          componentStatistics.incrementNumberEntitiesProcessed(count);
          if (insertFallback && count == 0) {
            modelTable=targetTableDefinition.getInsertTable();
            if (modelTable.shouldProcess(inputRow)) {
              log.debug("String_Node_Str");
              data=getValues(false,modelTable,inputRow);
              int endIndex=data.size() - modelTable.getKeyTargetColumns().size();
              count=execute(transaction,modelTable.getStatement(),new Object(),data.subList(0,endIndex));
              componentStatistics.incrementNumberEntitiesProcessed(count);
            }
          }
        }
      }
 else {
        try {
          TargetTable modelTable=targetTableDefinition.getInsertTable();
          if (modelTable.shouldProcess(inputRow)) {
            List<Object> data=getValues(false,modelTable,inputRow);
            int count=execute(transaction,modelTable.getStatement(),new Object(),data);
            componentStatistics.incrementNumberEntitiesProcessed(count);
          }
        }
 catch (        UniqueKeyException e) {
          if (replaceRows) {
            TargetTable modelTable=targetTableDefinition.getUpdateTable();
            if (modelTable.shouldProcess(inputRow)) {
              log.debug("String_Node_Str");
              List<Object> data=getValues(true,modelTable,inputRow);
              int count=execute(transaction,modelTable.getStatement(),new Object(),data);
              componentStatistics.incrementNumberEntitiesProcessed(count);
            }
          }
 else {
            throw e;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void write(ISqlTransaction transaction,List<EntityData> inputRows){
  for (  EntityData inputRow : inputRows) {
    for (    TargetTableDefintion targetTableDefinition : targetTables) {
      if (updateFirst) {
        TargetTable modelTable=targetTableDefinition.getUpdateTable();
        if (modelTable.shouldProcess(inputRow)) {
          List<Object> data=getValues(true,modelTable,inputRow);
          int count=execute(transaction,modelTable.getStatement(),new Object(),data);
          componentStatistics.incrementNumberEntitiesProcessed(count);
          if (insertFallback && count == 0) {
            modelTable=targetTableDefinition.getInsertTable();
            if (modelTable.shouldProcess(inputRow)) {
              log.debug("String_Node_Str");
              data=getValues(false,modelTable,inputRow);
              count=execute(transaction,modelTable.getStatement(),new Object(),data);
              componentStatistics.incrementNumberEntitiesProcessed(count);
            }
          }
        }
      }
 else {
        try {
          TargetTable modelTable=targetTableDefinition.getInsertTable();
          if (modelTable.shouldProcess(inputRow)) {
            List<Object> data=getValues(false,modelTable,inputRow);
            int count=execute(transaction,modelTable.getStatement(),new Object(),data);
            componentStatistics.incrementNumberEntitiesProcessed(count);
          }
        }
 catch (        UniqueKeyException e) {
          if (replaceRows) {
            TargetTable modelTable=targetTableDefinition.getUpdateTable();
            if (modelTable.shouldProcess(inputRow)) {
              log.debug("String_Node_Str");
              List<Object> data=getValues(true,modelTable,inputRow);
              int count=execute(transaction,modelTable.getStatement(),new Object(),data);
              componentStatistics.incrementNumberEntitiesProcessed(count);
            }
          }
 else {
            throw e;
          }
        }
      }
    }
  }
}