Program: 73697
Project: 73697
Buggy source:
/** 
 * @param iterator
 * @param keyColumnNames
 * @param measureColumnNames
 * @param stopSign
 * @return
 * @throws BirtException
 * @throws IOException
 */
private static DiskSortedStack getSortedFactTableRows(IDatasetIterator iterator,String[][] keyColumnNames,String[] measureColumnNames,StopSign stopSign) throws BirtException, IOException {
  DiskSortedStack result=new DiskSortedStack(Constants.FACT_TABLE_BUFFER_SIZE,true,false,FactTableRow.getCreator());
  int[][] levelKeyColumnIndex=new int[keyColumnNames.length][];
  int[] measureColumnIndex=new int[measureColumnNames.length];
  for (int i=0; i < keyColumnNames.length; i++) {
    levelKeyColumnIndex[i]=new int[keyColumnNames[i].length];
    for (int j=0; j < keyColumnNames[i].length; j++) {
      levelKeyColumnIndex[i][j]=iterator.getFieldIndex(keyColumnNames[i][j]);
    }
  }
  for (int i=0; i < measureColumnIndex.length; i++) {
    measureColumnIndex[i]=iterator.getFieldIndex(measureColumnNames[i]);
  }
  while (iterator.next() && !stopSign.isStopped()) {
    FactTableRow factTableRow=new FactTableRow();
    DimensionKey[] dimensionKeys=new DimensionKey[levelKeyColumnIndex.length];
    for (int i=0; i < levelKeyColumnIndex.length; i++) {
      dimensionKeys[i]=new DimensionKey(levelKeyColumnIndex[i].length);
      for (int j=0; j < levelKeyColumnIndex[i].length; j++) {
        if (levelKeyColumnIndex[i][j] >= 0)         dimensionKeys[i].getKeyValues()[j]=iterator.getValue(levelKeyColumnIndex[i][j]);
      }
    }
    factTableRow.setDimensionKeys(dimensionKeys);
    Object[] measures=new Object[measureColumnIndex.length];
    for (int i=0; i < measureColumnIndex.length; i++) {
      measures[i]=iterator.getValue(measureColumnIndex[i]);
      if (measures[i] == null) {
        factTableRow.setMeasures(measures);
        throw new DataException(ResourceConstants.FACTTABLE_NULL_MEASURE_VALUE,factTableRow.toString());
      }
    }
    factTableRow.setMeasures(measures);
    result.push(factTableRow);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param iterator
 * @param keyColumnNames
 * @param measureColumnNames
 * @param stopSign
 * @return
 * @throws BirtException
 * @throws IOException
 */
private static DiskSortedStack getSortedFactTableRows(IDatasetIterator iterator,String[][] keyColumnNames,String[] measureColumnNames,StopSign stopSign) throws BirtException, IOException {
  DiskSortedStack result=new DiskSortedStack(Constants.FACT_TABLE_BUFFER_SIZE,true,false,FactTableRow.getCreator());
  int[][] levelKeyColumnIndex=new int[keyColumnNames.length][];
  int[] measureColumnIndex=new int[measureColumnNames.length];
  for (int i=0; i < keyColumnNames.length; i++) {
    levelKeyColumnIndex[i]=new int[keyColumnNames[i].length];
    for (int j=0; j < keyColumnNames[i].length; j++) {
      levelKeyColumnIndex[i][j]=iterator.getFieldIndex(keyColumnNames[i][j]);
    }
  }
  for (int i=0; i < measureColumnIndex.length; i++) {
    measureColumnIndex[i]=iterator.getFieldIndex(measureColumnNames[i]);
  }
  while (iterator.next() && !stopSign.isStopped()) {
    FactTableRow factTableRow=new FactTableRow();
    DimensionKey[] dimensionKeys=new DimensionKey[levelKeyColumnIndex.length];
    for (int i=0; i < levelKeyColumnIndex.length; i++) {
      dimensionKeys[i]=new DimensionKey(levelKeyColumnIndex[i].length);
      for (int j=0; j < levelKeyColumnIndex[i].length; j++) {
        if (levelKeyColumnIndex[i][j] >= 0)         dimensionKeys[i].getKeyValues()[j]=iterator.getValue(levelKeyColumnIndex[i][j]);
      }
    }
    factTableRow.setDimensionKeys(dimensionKeys);
    Object[] measures=new Object[measureColumnIndex.length];
    for (int i=0; i < measureColumnIndex.length; i++) {
      measures[i]=iterator.getValue(measureColumnIndex[i]);
    }
    factTableRow.setMeasures(measures);
    result.push(factTableRow);
  }
  return result;
}