Program: 66125
Project: 66125
Buggy source:
/** 
 * @param cubeHandle
 * @param query
 * @param resultMetaList
 * @throws DataException
 * @throws AdapterException
 */
private void prepareMeasure(TabularCubeHandle cubeHandle,QueryDefinition query,List metaList) throws AdapterException {
  try {
    List measureGroups=cubeHandle.getContents(CubeHandle.MEASURE_GROUPS_PROP);
    for (int i=0; i < measureGroups.size(); i++) {
      MeasureGroupHandle mgh=(MeasureGroupHandle)measureGroups.get(i);
      List measures=mgh.getContents(MeasureGroupHandle.MEASURES_PROP);
      for (int j=0; j < measures.size(); j++) {
        MeasureHandle measure=(MeasureHandle)measures.get(j);
        String function=measure.getFunction();
        String exprText=measure.getMeasureExpression();
        ExpressionHandle measureExprHandle=measure.getExpressionProperty(IMeasureModel.MEASURE_EXPRESSION_PROP);
        IScriptExpression expr=null;
        if (exprText != null && measureExprHandle != null) {
          expr=modelAdaptor.adaptJSExpression(measureExprHandle.getStringExpression(),measureExprHandle.getType());
        }
        Binding binding=new Binding(measure.getName(),expr);
        binding.setAggrFunction(DataAdapterUtil.adaptModelAggregationType(function));
        query.addBinding(binding);
        DataSetIterator.ColumnMeta meta=new DataSetIterator.ColumnMeta(measure.getName(),null,DataSetIterator.ColumnMeta.MEASURE_TYPE);
        meta.setDataType(DataAdapterUtil.adaptModelDataType(measure.getDataType()));
        metaList.add(meta);
      }
    }
  }
 catch (  DataException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * @param cubeHandle
 * @param query
 * @param resultMetaList
 * @throws DataException
 * @throws AdapterException
 */
private void prepareMeasure(TabularCubeHandle cubeHandle,QueryDefinition query,List metaList) throws AdapterException {
  try {
    List measureGroups=cubeHandle.getContents(CubeHandle.MEASURE_GROUPS_PROP);
    for (int i=0; i < measureGroups.size(); i++) {
      MeasureGroupHandle mgh=(MeasureGroupHandle)measureGroups.get(i);
      List measures=mgh.getContents(MeasureGroupHandle.MEASURES_PROP);
      for (int j=0; j < measures.size(); j++) {
        MeasureHandle measure=(MeasureHandle)measures.get(j);
        if (measure.isCalculated()) {
          continue;
        }
        String function=measure.getFunction();
        String exprText=measure.getMeasureExpression();
        ExpressionHandle measureExprHandle=measure.getExpressionProperty(IMeasureModel.MEASURE_EXPRESSION_PROP);
        IScriptExpression expr=null;
        if (exprText != null && measureExprHandle != null) {
          expr=modelAdaptor.adaptJSExpression(measureExprHandle.getStringExpression(),measureExprHandle.getType());
        }
        Binding binding=new Binding(measure.getName(),expr);
        binding.setAggrFunction(DataAdapterUtil.adaptModelAggregationType(function));
        query.addBinding(binding);
        DataSetIterator.ColumnMeta meta=new DataSetIterator.ColumnMeta(measure.getName(),null,DataSetIterator.ColumnMeta.MEASURE_TYPE);
        meta.setDataType(DataAdapterUtil.adaptModelDataType(measure.getDataType()));
        metaList.add(meta);
      }
    }
  }
 catch (  DataException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}