Program: 67152
Project: 67152
Buggy source:
/** 
 * @param crosstab
 * @param measureView
 * @param function
 * @param rowDimension
 * @param rowLevel
 * @param colDimension
 * @param colLevel
 * @throws SemanticException
 */
public static void addDataItem(CrosstabReportItemHandle crosstab,AggregationCellHandle cell,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel,boolean forceAdd) throws SemanticException {
  if (crosstab == null || measureView == null)   return;
  if (cell == null) {
    cell=measureView.getAggregationCell(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell == null && forceAdd) {
    cell=measureView.addAggregation(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell != null && !(measureView instanceof ComputedMeasureViewHandle)) {
    String name=CrosstabModelUtil.generateComputedColumnName(measureView,colLevel,rowLevel);
    ComputedColumn column=StructureFactory.newComputedColumn(crosstab.getModelHandle(),name);
    String dataType=measureView.getDataType();
    column.setDataType(dataType);
    column.setExpression(ExpressionUtil.createJSMeasureExpression(measureView.getCubeMeasureName()));
    String defaultFunction=getDefaultMeasureAggregationFunction(measureView);
    column.setAggregateFunction(function != null ? function : defaultFunction);
    if (function != null && !function.equals(defaultFunction)) {
      try {
        column.setDataType(DataAdapterUtil.adapterToModelDataType(getAggregationManager().getAggregation(column.getAggregateFunction()).getDataType()));
      }
 catch (      BirtException e) {
      }
    }
    if (rowLevel != null) {
      column.addAggregateOn(rowLevel);
    }
    if (colLevel != null) {
      column.addAggregateOn(colLevel);
    }
    ComputedColumnHandle columnHandle=((ReportItemHandle)crosstab.getModelHandle()).addColumnBinding(column,false);
    if (cell.getContents().size() == 0) {
      DataItemHandle dataItem=crosstab.getModuleHandle().getElementFactory().newDataItem(null);
      dataItem.setResultSetColumn(columnHandle.getName());
      cell.addContent(dataItem);
    }
 else     if (cell.getContents().size() == 1 && cell.getContents().get(0) instanceof DataItemHandle) {
      DataItemHandle dataItem=(DataItemHandle)cell.getContents().get(0);
      dataItem.setResultSetColumn(columnHandle.getName());
    }
  }
}

Fixed version (ground truth):
/** 
 * @param crosstab
 * @param measureView
 * @param function
 * @param rowDimension
 * @param rowLevel
 * @param colDimension
 * @param colLevel
 * @throws SemanticException
 */
public static void addDataItem(CrosstabReportItemHandle crosstab,AggregationCellHandle cell,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel,boolean forceAdd) throws SemanticException {
  if (crosstab == null || measureView == null)   return;
  if (cell == null) {
    cell=measureView.getAggregationCell(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell == null && forceAdd) {
    cell=measureView.addAggregation(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell != null && !(measureView instanceof ComputedMeasureViewHandle)) {
    String name=CrosstabModelUtil.generateComputedColumnName(measureView,colLevel,rowLevel);
    ComputedColumn column=StructureFactory.newComputedColumn(crosstab.getModelHandle(),name);
    String dataType=measureView.getDataType();
    column.setDataType(dataType);
    column.setExpression(ExpressionUtil.createJSMeasureExpression(measureView.getCubeMeasureName()));
    String defaultFunction=getDefaultMeasureAggregationFunction(measureView);
    column.setAggregateFunction(function != null ? function : defaultFunction);
    if (function != null && !function.equals(defaultFunction)) {
      try {
        String targetType=DataAdapterUtil.adapterToModelDataType(getAggregationManager().getAggregation(column.getAggregateFunction()).getDataType());
        if (!DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(targetType)) {
          column.setDataType(targetType);
        }
      }
 catch (      BirtException e) {
      }
    }
    if (rowLevel != null) {
      column.addAggregateOn(rowLevel);
    }
    if (colLevel != null) {
      column.addAggregateOn(colLevel);
    }
    ComputedColumnHandle columnHandle=((ReportItemHandle)crosstab.getModelHandle()).addColumnBinding(column,false);
    if (cell.getContents().size() == 0) {
      DataItemHandle dataItem=crosstab.getModuleHandle().getElementFactory().newDataItem(null);
      dataItem.setResultSetColumn(columnHandle.getName());
      cell.addContent(dataItem);
    }
 else     if (cell.getContents().size() == 1 && cell.getContents().get(0) instanceof DataItemHandle) {
      DataItemHandle dataItem=(DataItemHandle)cell.getContents().get(0);
      dataItem.setResultSetColumn(columnHandle.getName());
    }
  }
}