Program: 68730
Project: 68730
Buggy source:
private IBinding[] getCrosstabBindings(CrosstabReportItemHandle xtabHandle) throws BirtException {
  Iterator bindingItr=((ExtendedItemHandle)xtabHandle.getModelHandle()).columnBindingsIterator();
  ModuleHandle module=((ExtendedItemHandle)xtabHandle.getModelHandle()).getModuleHandle();
  List<IBinding> bindingList=new ArrayList<IBinding>();
  if (bindingItr != null) {
    Map cache=new HashMap();
    List rowLevelNameList=new ArrayList();
    List columnLevelNameList=new ArrayList();
    DataRequestSession session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    try {
      IModelAdapter modelAdapter=session.getModelAdaptor();
      while (bindingItr.hasNext()) {
        ComputedColumnHandle column=(ComputedColumnHandle)bindingItr.next();
        Binding binding=new Binding(column.getName());
        binding.setAggrFunction(column.getAggregateFunction() == null ? null : DataAdapterUtil.adaptModelAggregationType(column.getAggregateFunction()));
        binding.setExpression(modelAdapter.adaptExpression((Expression)column.getExpressionProperty(ComputedColumn.EXPRESSION_MEMBER).getValue()));
        binding.setDataType(DataAdapterUtil.adaptModelDataType(column.getDataType()));
        if (column.getFilterExpression() != null) {
          binding.setFilter(modelAdapter.adaptExpression((Expression)column.getExpressionProperty(ComputedColumn.FILTER_MEMBER).getValue()));
        }
        for (Iterator argItr=column.argumentsIterator(); argItr.hasNext(); ) {
          AggregationArgumentHandle aah=(AggregationArgumentHandle)argItr.next();
          if (aah.getValue() != null) {
            binding.addArgument(modelAdapter.adaptExpression((Expression)aah.getExpressionProperty(AggregationArgument.VALUE_MEMBER).getValue()));
          }
        }
        List aggrList=column.getAggregateOnList();
        if (aggrList != null) {
          for (Iterator aggrItr=aggrList.iterator(); aggrItr.hasNext(); ) {
            String baseLevel=(String)aggrItr.next();
            CrosstabUtil.addHierachyAggregateOn(module,binding,baseLevel,rowLevelNameList,columnLevelNameList,cache);
          }
        }
        bindingList.add(binding);
      }
    }
  finally {
      session.shutdown();
    }
  }
  return bindingList.toArray(new IBinding[bindingList.size()]);
}

Fixed version (ground truth):
private IBinding[] getCrosstabBindings(CrosstabReportItemHandle xtabHandle) throws BirtException {
  Iterator bindingItr=((ExtendedItemHandle)xtabHandle.getModelHandle()).columnBindingsIterator();
  ModuleHandle module=((ExtendedItemHandle)xtabHandle.getModelHandle()).getModuleHandle();
  List<IBinding> bindingList=new ArrayList<IBinding>();
  if (bindingItr != null) {
    Map cache=new HashMap();
    List rowLevelNameList=new ArrayList();
    List columnLevelNameList=new ArrayList();
    DataRequestSession session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    try {
      IModelAdapter modelAdapter=session.getModelAdaptor();
      while (bindingItr.hasNext()) {
        ComputedColumnHandle column=(ComputedColumnHandle)bindingItr.next();
        Binding binding=new Binding(column.getName());
        binding.setAggrFunction(column.getAggregateFunction() == null ? null : DataAdapterUtil.adaptModelAggregationType(column.getAggregateFunction()));
        binding.setExpression(modelAdapter.adaptExpression((Expression)column.getExpressionProperty(ComputedColumn.EXPRESSION_MEMBER).getValue(),ExpressionLocation.CUBE));
        binding.setDataType(DataAdapterUtil.adaptModelDataType(column.getDataType()));
        if (column.getFilterExpression() != null) {
          binding.setFilter(modelAdapter.adaptExpression((Expression)column.getExpressionProperty(ComputedColumn.FILTER_MEMBER).getValue(),ExpressionLocation.CUBE));
        }
        for (Iterator argItr=column.argumentsIterator(); argItr.hasNext(); ) {
          AggregationArgumentHandle aah=(AggregationArgumentHandle)argItr.next();
          if (aah.getValue() != null) {
            binding.addArgument(modelAdapter.adaptExpression((Expression)aah.getExpressionProperty(AggregationArgument.VALUE_MEMBER).getValue(),ExpressionLocation.CUBE));
          }
        }
        List aggrList=column.getAggregateOnList();
        if (aggrList != null) {
          for (Iterator aggrItr=aggrList.iterator(); aggrItr.hasNext(); ) {
            String baseLevel=(String)aggrItr.next();
            CrosstabUtil.addHierachyAggregateOn(module,binding,baseLevel,rowLevelNameList,columnLevelNameList,cache);
          }
        }
        bindingList.add(binding);
      }
    }
  finally {
      session.shutdown();
    }
  }
  return bindingList.toArray(new IBinding[bindingList.size()]);
}