Program: 68723
Project: 68723
Buggy source:
/** 
 * @param modelDataSet
 * @param dteDataSet
 */
private static void mergeHints(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet){
  Iterator elmtIter;
  if (modelDataSet instanceof OdaDataSetHandle) {
    elmtIter=modelDataSet.resultSetIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        OdaResultSetColumnHandle modelColumn=(OdaResultSetColumnHandle)elmtIter.next();
        if (!modelColumn.getColumnName().equals(modelColumn.getNativeName()))         dteDataSet.addResultSetHint(new ColumnAdapter((ResultSetColumnHandle)modelColumn));
      }
    }
  }
  elmtIter=modelDataSet.resultSetHintsIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ResultSetColumnHandle modelColumn=(ResultSetColumnHandle)elmtIter.next();
      dteDataSet.addResultSetHint(new ColumnAdapter(modelColumn));
    }
  }
  elmtIter=modelDataSet.columnHintsIterator();
  if (elmtIter != null) {
    List columnDefns=dteDataSet.getResultSetHints();
    while (elmtIter.hasNext()) {
      ColumnHintHandle modelColumnHint=(ColumnHintHandle)elmtIter.next();
      ColumnDefinition existDefn=findColumnDefn(columnDefns,modelColumnHint.getColumnName());
      if (existDefn != null)       updateColumnDefn(existDefn,modelColumnHint);
 else       dteDataSet.addResultSetHint(new ColumnAdapter(modelColumnHint));
    }
  }
  if (modelDataSet instanceof OdaDataSetHandle) {
    elmtIter=modelDataSet.resultSetIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        OdaResultSetColumnHandle modelColumn=(OdaResultSetColumnHandle)elmtIter.next();
        ColumnDefinition columnDefn=findColumnDefn(dteDataSet.getResultSetHints(),modelColumn.getColumnName());
        if (columnDefn != null)         columnDefn.setDataType(org.eclipse.birt.report.data.adapter.api.DataAdapterUtil.adaptModelDataType(modelColumn.getDataType()));
 else {
          ColumnAdapter adapter=new ColumnAdapter((ResultSetColumnHandle)modelColumn);
          adapter.setColumnPosition(0);
          dteDataSet.addResultSetHint(adapter);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param modelDataSet
 * @param dteDataSet
 */
private static void mergeHints(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet){
  Iterator elmtIter;
  if (modelDataSet instanceof OdaDataSetHandle) {
    elmtIter=modelDataSet.resultSetIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        OdaResultSetColumnHandle modelColumn=(OdaResultSetColumnHandle)elmtIter.next();
        if (!modelColumn.getColumnName().equals(modelColumn.getNativeName()))         dteDataSet.addResultSetHint(new ColumnAdapter((ResultSetColumnHandle)modelColumn));
      }
    }
  }
  elmtIter=modelDataSet.resultSetHintsIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ResultSetColumnHandle modelColumn=(ResultSetColumnHandle)elmtIter.next();
      dteDataSet.addResultSetHint(new ColumnAdapter(modelColumn));
    }
  }
  elmtIter=modelDataSet.columnHintsIterator();
  if (elmtIter != null) {
    List columnDefns=dteDataSet.getResultSetHints();
    while (elmtIter.hasNext()) {
      ColumnHintHandle modelColumnHint=(ColumnHintHandle)elmtIter.next();
      ColumnDefinition existDefn=findColumnDefn(columnDefns,modelColumnHint.getColumnName());
      if (existDefn != null)       updateColumnDefn(existDefn,modelColumnHint);
 else       dteDataSet.addResultSetHint(new ColumnAdapter(modelColumnHint));
    }
  }
  if (modelDataSet instanceof OdaDataSetHandle) {
    elmtIter=modelDataSet.resultSetIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        OdaResultSetColumnHandle modelColumn=(OdaResultSetColumnHandle)elmtIter.next();
        ColumnDefinition columnDefn=findColumnDefn(dteDataSet.getResultSetHints(),modelColumn.getColumnName());
        if (columnDefn != null) {
          columnDefn.setColumnNativeName(modelColumn.getNativeName());
          columnDefn.setColumnPosition(modelColumn.getPosition());
          columnDefn.setDataType(org.eclipse.birt.report.data.adapter.api.DataAdapterUtil.adaptModelDataType(modelColumn.getDataType()));
        }
 else {
          ColumnAdapter adapter=new ColumnAdapter((ResultSetColumnHandle)modelColumn);
          adapter.setColumnNativeName(modelColumn.getNativeName());
          adapter.setColumnPosition(modelColumn.getPosition());
          dteDataSet.addResultSetHint(adapter);
        }
      }
    }
  }
}