Program: 67113
Project: 67113
Buggy source:
private int getFilterType(IFilterDefinition filter,Set<DimLevel> dimLevelInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition)) {
    if (filter.getExpression() instanceof ICollectionConditionalExpression) {
      Collection<IScriptExpression> exprs=((ICollectionConditionalExpression)(filter.getExpression())).getExpr();
      Set dimensionSet=new HashSet();
      Iterator<IScriptExpression> exprsIterator=exprs.iterator();
      while (exprsIterator.hasNext()) {
        Iterator dimLevels=OlapExpressionCompiler.getReferencedDimLevel(exprsIterator.next(),this.defn.getBindings()).iterator();
        while (dimLevels.hasNext())         dimensionSet.add(((DimLevel)dimLevels.next()).getDimensionName());
      }
      if (dimensionSet.size() == 1)       return CubeQueryExecutor.DIMENSION_FILTER;
 else       return CubeQueryExecutor.FACTTABLE_FILTER;
    }
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null) {
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
 else {
    String measure=OlapExpressionCompiler.getReferencedScriptObject(filter.getExpression(),ScriptConstants.MEASURE_SCRIPTABLE);
    if (measure != null)     return CubeQueryExecutor.FACTTABLE_FILTER;
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    if (bindingName.size() > 0) {
      if (existAggregationBinding(bindingName,this.defn.getBindings()))       return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      return CubeQueryExecutor.FACTTABLE_FILTER;
    }
 else {
      List dimensionName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE);
      if (dimensionName.size() > 1) {
        return FACTTABLE_FILTER;
      }
      return DIMENSION_FILTER;
    }
  }
}

Fixed version (ground truth):
private int getFilterType(IFilterDefinition filter,Set<String> dimNamesInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition)) {
    if (filter.getExpression() instanceof ICollectionConditionalExpression) {
      Collection<IScriptExpression> exprs=((ICollectionConditionalExpression)(filter.getExpression())).getExpr();
      Set dimensionSet=new HashSet();
      Iterator<IScriptExpression> exprsIterator=exprs.iterator();
      while (exprsIterator.hasNext()) {
        Iterator dimLevels=OlapExpressionCompiler.getReferencedDimLevel(exprsIterator.next(),this.defn.getBindings()).iterator();
        while (dimLevels.hasNext())         dimensionSet.add(((DimLevel)dimLevels.next()).getDimensionName());
      }
      if (dimensionSet.size() == 1)       return CubeQueryExecutor.DIMENSION_FILTER;
 else       return CubeQueryExecutor.FACTTABLE_FILTER;
    }
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null) {
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
 else {
    String measure=OlapExpressionCompiler.getReferencedScriptObject(filter.getExpression(),ScriptConstants.MEASURE_SCRIPTABLE);
    if (measure != null)     return CubeQueryExecutor.FACTTABLE_FILTER;
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    if (bindingName.size() > 0) {
      if (existAggregationBinding(bindingName,this.defn.getBindings()))       return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      return CubeQueryExecutor.FACTTABLE_FILTER;
    }
 else {
      List dimensionName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE);
      if (dimensionName.size() > 1 || !dimNamesInCubeQuery.containsAll(dimensionName)) {
        return FACTTABLE_FILTER;
      }
      return DIMENSION_FILTER;
    }
  }
}