Program: 66499
Project: 66499
Buggy source:
public CubeCursorImpl(IBaseQueryResults outerResults,CubeCursor cursor,Scriptable scope,ScriptContext cx,ICubeQueryDefinition queryDefn,BirtCubeView view) throws DataException {
  this.cursor=cursor;
  this.scope=scope;
  this.queryDefn=queryDefn;
  this.cubeView=view;
  this.cx=cx;
  this.dimensionCursorMap=new HashMap<DimLevel,DimensionCursor>();
  populateDimensionCursor();
  this.outerResults=OlapExpressionUtil.createQueryResultsScriptable(outerResults);
  this.bindingMap=new HashMap();
  this.validBindingSet=new HashSet();
  this.dataTypeMap=new HashMap();
  List<IBinding> allBindings=CubeQueryDefinitionUtil.getAllBindings(queryDefn);
  for (int i=0; i < allBindings.size(); i++) {
    IBinding binding=(IBinding)allBindings.get(i);
    final String bindingName=binding.getBindingName();
    validBindingSet.add(bindingName);
    final IBaseExpression expr=binding.getExpression();
    if (binding.getAggrFunction() == null) {
      this.bindingMap.put(bindingName,expr);
      if (expr instanceof IScriptExpression) {
        if (!isSimpleDimensionExpression(((IScriptExpression)expr).getText()))         OLAPExpressionCompiler.compile(cx.newContext(this.scope),expr);
      }
 else       OLAPExpressionCompiler.compile(cx.newContext(this.scope),expr);
    }
    dataTypeMap.put(bindingName,Integer.valueOf(binding.getDataType()));
  }
  this.scope.put(ScriptConstants.DATA_BINDING_SCRIPTABLE,this.scope,new JSCubeBindingObject(this));
  this.scope.put(ScriptConstants.DATA_SET_BINDING_SCRIPTABLE,this.scope,new JSCubeBindingObject(this));
}

Fixed version (ground truth):
public CubeCursorImpl(IBaseQueryResults outerResults,CubeCursor cursor,Scriptable scope,ScriptContext cx,ICubeQueryDefinition queryDefn,BirtCubeView view) throws DataException {
  this.cursor=cursor;
  this.scope=scope;
  this.queryDefn=queryDefn;
  this.cubeView=view;
  this.cx=cx;
  this.dimensionCursorMap=new HashMap<DimLevel,DimensionCursor>();
  populateDimensionCursor();
  this.outerResults=OlapExpressionUtil.createQueryResultsScriptable(outerResults);
  this.bindingMap=new HashMap();
  this.dimLevelMap=new HashMap<String,DimLevel>();
  this.validBindingSet=new HashSet();
  this.dataTypeMap=new HashMap();
  List<IBinding> allBindings=CubeQueryDefinitionUtil.getAllBindings(queryDefn);
  for (int i=0; i < allBindings.size(); i++) {
    IBinding binding=(IBinding)allBindings.get(i);
    final String bindingName=binding.getBindingName();
    validBindingSet.add(bindingName);
    final IBaseExpression expr=binding.getExpression();
    if (binding.getAggrFunction() == null) {
      this.bindingMap.put(bindingName,expr);
      if (expr instanceof IScriptExpression) {
        if (!isSimpleDimensionExpression(((IScriptExpression)expr).getText()))         OLAPExpressionCompiler.compile(cx.newContext(this.scope),expr);
      }
 else       OLAPExpressionCompiler.compile(cx.newContext(this.scope),expr);
    }
    dataTypeMap.put(bindingName,Integer.valueOf(binding.getDataType()));
  }
  this.scope.put(ScriptConstants.DATA_BINDING_SCRIPTABLE,this.scope,new JSCubeBindingObject(this));
  this.scope.put(ScriptConstants.DATA_SET_BINDING_SCRIPTABLE,this.scope,new JSCubeBindingObject(this));
}