Program: 73906
Project: 73906
Buggy source:
/** 
 * @param crosstab
 * @param measureView
 * @param function
 * @param rowDimension
 * @param rowLevel
 * @param colDimension
 * @param colLevel
 * @throws SemanticException
 */
public static void addDataItem(CrosstabReportItemHandle crosstab,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel) throws SemanticException {
  if (crosstab == null || measureView == null)   return;
  AggregationCellHandle cell=measureView.getAggregationCell(rowDimension,rowLevel,colDimension,colLevel);
  if (cell == null) {
    cell=measureView.addAggregation(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell != null && cell.getContents().size() == 0) {
    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()));
    column.setAggregateFunction(function != null ? function : getDefaultMeasureAggregationFunction(measureView));
    if (rowLevel != null) {
      column.addAggregateOn(rowLevel);
    }
    if (colLevel != null) {
      column.addAggregateOn(colLevel);
    }
    ComputedColumnHandle columnHandle=((ReportItemHandle)crosstab.getModelHandle()).addColumnBinding(column,false);
    DataItemHandle dataItem=crosstab.getModuleHandle().getElementFactory().newDataItem(null);
    dataItem.setResultSetColumn(columnHandle.getName());
    cell.addContent(dataItem);
  }
}

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,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel,boolean forceAdd) throws SemanticException {
  if (crosstab == null || measureView == null)   return;
  AggregationCellHandle cell=measureView.getAggregationCell(rowDimension,rowLevel,colDimension,colLevel);
  if (cell == null && forceAdd) {
    cell=measureView.addAggregation(rowDimension,rowLevel,colDimension,colLevel);
  }
  if (cell != null && cell.getContents().size() == 0) {
    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()));
    column.setAggregateFunction(function != null ? function : getDefaultMeasureAggregationFunction(measureView));
    if (rowLevel != null) {
      column.addAggregateOn(rowLevel);
    }
    if (colLevel != null) {
      column.addAggregateOn(colLevel);
    }
    ComputedColumnHandle columnHandle=((ReportItemHandle)crosstab.getModelHandle()).addColumnBinding(column,false);
    DataItemHandle dataItem=crosstab.getModuleHandle().getElementFactory().newDataItem(null);
    dataItem.setResultSetColumn(columnHandle.getName());
    cell.addContent(dataItem);
  }
}