Program: 66893
Project: 66893
Buggy source:
/** 
 * @param dataSet
 * @param resultSet
 * @throws BirtException
 */
private void saveResultToDataItems(DataSetHandle dataSet,IQueryResults resultSet) throws BirtException {
  IResultMetaData metaData=resultSet.getResultMetaData();
  int columnCount=0;
  if (metaData != null)   columnCount=metaData.getColumnCount();
  DataSetViewData[] columns=new DataSetViewData[columnCount];
  HashSet orgColumnNameSet=new HashSet();
  HashSet uniqueColumnNameSet=new HashSet();
  for (int n=0; n < columns.length; n++) {
    orgColumnNameSet.add(metaData.getColumnName(n + 1));
  }
  for (int n=0; n < columns.length; n++) {
    columns[n]=new DataSetViewData();
    columns[n].setParent(dataSet);
    columns[n].setDataType(metaData.getColumnType(n + 1));
    columns[n].setDataTypeName(metaData.getColumnTypeName(n + 1));
    columns[n].setPosition(n + 1);
    columns[n].setAlias(metaData.getColumnAlias(n + 1));
    columns[n].setComputedColumn(metaData.isComputedColumn(n + 1));
    String columnName=metaData.getColumnName(n + 1);
    String uniqueColumnName=getUniqueName(orgColumnNameSet,uniqueColumnNameSet,columnName,n);
    columns[n].setDataSetColumnName(uniqueColumnName);
    uniqueColumnNameSet.add(uniqueColumnName);
    ColumnHintHandle hint=findColumnHint(dataSet,columns[n].getName());
    if (hint != null) {
      columns[n].setAnalysis(hint.getAnalysis());
      columns[n].setAnalysisColumn(hint.getAnalysisColumn());
      columns[n].setACLExpression(hint.getACLExpression());
      columns[n].setFormat(hint.getFormat());
      columns[n].setDisplayLength(hint.getDisplayLength());
      columns[n].setHeading(hint.getHeading());
      columns[n].setHelpText(hint.getHelpText());
      columns[n].setHorizontalAlign(hint.getHorizontalAlign());
      columns[n].setTextFormat(hint.getTextFormat());
      columns[n].setDescription(hint.getDescription());
      columns[n].setWordWrap(hint.wordWrap());
      columns[n].setFormatValue(hint.getValueFormat());
      columns[n].setIndexColumn(hint.isIndexColumn());
      columns[n].setRemoveDuplicateValues(hint.isCompressed());
    }
    if (!uniqueColumnName.equals(columnName))     updateModelColumn(dataSet,columns[n]);
  }
  updateModel(dataSet,columns);
  htColumns.put(dataSet,columns);
}

Fixed version (ground truth):
/** 
 * @param dataSet
 * @param resultSet
 * @throws BirtException
 */
private void saveResultToDataItems(DataSetHandle dataSet,IQueryResults resultSet) throws BirtException {
  IResultMetaData metaData=resultSet.getResultMetaData();
  int columnCount=0;
  if (metaData != null)   columnCount=metaData.getColumnCount();
  DataSetViewData[] columns=new DataSetViewData[columnCount];
  HashSet orgColumnNameSet=new HashSet();
  HashSet uniqueColumnNameSet=new HashSet();
  for (int n=0; n < columns.length; n++) {
    orgColumnNameSet.add(metaData.getColumnName(n + 1));
  }
  for (int n=0; n < columns.length; n++) {
    columns[n]=new DataSetViewData();
    columns[n].setParent(dataSet);
    columns[n].setDataType(metaData.getColumnType(n + 1));
    columns[n].setDataTypeName(metaData.getColumnTypeName(n + 1));
    columns[n].setPosition(n + 1);
    columns[n].setAlias(metaData.getColumnAlias(n + 1));
    columns[n].setComputedColumn(metaData.isComputedColumn(n + 1));
    String columnName=metaData.getColumnName(n + 1);
    String uniqueColumnName=getUniqueName(orgColumnNameSet,uniqueColumnNameSet,columnName,n);
    columns[n].setDataSetColumnName(uniqueColumnName);
    uniqueColumnNameSet.add(uniqueColumnName);
    ColumnHintHandle hint=findColumnHint(dataSet,columns[n].getName());
    if (hint != null) {
      columns[n].setDisplayName(hint.getDisplayName());
      columns[n].setDisplayNameKey(hint.getDisplayNameKey());
      columns[n].setAnalysis(hint.getAnalysis());
      columns[n].setAnalysisColumn(hint.getAnalysisColumn());
      columns[n].setACLExpression(hint.getACLExpression());
      columns[n].setFormat(hint.getFormat());
      columns[n].setDisplayLength(hint.getDisplayLength());
      columns[n].setHeading(hint.getHeading());
      columns[n].setHelpText(hint.getHelpText());
      columns[n].setHorizontalAlign(hint.getHorizontalAlign());
      columns[n].setTextFormat(hint.getTextFormat());
      columns[n].setDescription(hint.getDescription());
      columns[n].setWordWrap(hint.wordWrap());
      columns[n].setFormatValue(hint.getValueFormat());
      columns[n].setIndexColumn(hint.isIndexColumn());
      columns[n].setRemoveDuplicateValues(hint.isCompressed());
    }
    if (!uniqueColumnName.equals(columnName))     updateModelColumn(dataSet,columns[n]);
  }
  updateModel(dataSet,columns);
  htColumns.put(dataSet,columns);
}