Program: 77649
Project: 77649
Buggy source:
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle) throws BirtException {
  List resultSetList=null;
  if (dataSetHandle instanceof OdaDataSetHandle) {
    resultSetList=(List)dataSetHandle.getProperty(OdaDataSetHandle.RESULT_SET_PROP);
    dataSetHandle.getPropertyHandle(DataSetHandle.RESULT_SET_HINTS_PROP).clearValue();
  }
 else {
    return null;
  }
  int columnCount=0;
  if (resultSetList != null)   columnCount=resultSetList.size();
  List computedList=(List)dataSetHandle.getProperty(OdaDataSetHandle.COMPUTED_COLUMNS_PROP);
  if (computedList != null)   columnCount+=computedList.size();
  DataSetViewData[] items=new DataSetViewData[columnCount];
  DataSetViewData item;
  int index=0;
  if (resultSetList != null) {
    ResultSetColumn resultSetColumn;
    HashSet orgColumnNameSet=new HashSet();
    HashSet uniqueColumnNameSet=new HashSet();
    for (int n=0; n < resultSetList.size(); n++) {
      orgColumnNameSet.add(((ResultSetColumn)resultSetList.get(n)).getColumnName());
    }
    for (int i=0; i < resultSetList.size(); i++) {
      item=new DataSetViewData();
      resultSetColumn=(ResultSetColumn)resultSetList.get(i);
      String uniqueName=getUniqueName(orgColumnNameSet,uniqueColumnNameSet,resultSetColumn.getColumnName(),i);
      item.setName(uniqueName);
      uniqueColumnNameSet.add(uniqueName);
      item.setDataTypeName(resultSetColumn.getDataType());
      item.setPosition(resultSetColumn.getPosition().intValue());
      item.setComputedColumn(false);
      item.setDataSetColumnName(uniqueName);
      if (!uniqueName.equals(resultSetColumn.getColumnName())) {
        updateModelColumn(dataSetHandle,item);
      }
      ColumnHintHandle columnHint=findColumnHint(dataSetHandle,uniqueName);
      if (columnHint != null) {
        item.setAlias(columnHint.getAlias());
        item.setDisplayName(columnHint.getDisplayName());
      }
      items[index]=item;
      index++;
    }
    if (computedList != null) {
      ComputedColumn computedColumn;
      Iterator computedColumnIterator=computedList.iterator();
      while (computedColumnIterator.hasNext()) {
        item=new DataSetViewData();
        computedColumn=(ComputedColumn)computedColumnIterator.next();
        item.setName(computedColumn.getName());
        item.setDataTypeName(computedColumn.getDataType());
        item.setComputedColumn(true);
        if (findColumnHint(dataSetHandle,computedColumn.getName()) != null) {
          ColumnHintHandle columnHint=findColumnHint(dataSetHandle,computedColumn.getName());
          item.setAlias(columnHint.getAlias());
          item.setDisplayName(columnHint.getDisplayName());
        }
        items[index]=item;
        index++;
      }
    }
    return items;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle) throws BirtException {
  DataSessionContext context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,dataSetHandle.getModuleHandle());
  DataRequestSession session=DataRequestSession.newSession(context);
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,false);
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(metaData.getColumnTypeName(i + 1));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
  }
  updateModel(dataSetHandle,items);
  return items;
}