Program: 68724
Project: 68724
Buggy source:
private static void addLevelFilter(List<LevelViewHandle> levelViews,Map<LevelHandle,ILevelDefinition> levelMapping,ICubeQueryDefinition cubeQuery,IModelAdapter modelAdapter) throws BirtException {
  List<ILevelDefinition> levels=new ArrayList<ILevelDefinition>();
  List<Object> values=new ArrayList<Object>();
  for (Iterator<LevelViewHandle> itr=levelViews.iterator(); itr.hasNext(); ) {
    LevelViewHandle lv=itr.next();
    Iterator filterItr=lv.filtersIterator();
    if (filterItr != null) {
      while (filterItr.hasNext()) {
        FilterConditionElementHandle filterCon=(FilterConditionElementHandle)filterItr.next();
        levels.clear();
        values.clear();
        addMembers(levelMapping,levels,values,filterCon.getMember());
        ILevelDefinition[] qualifyLevels=null;
        Object[] qualifyValues=null;
        if (levels.size() > 0) {
          qualifyLevels=levels.toArray(new ILevelDefinition[levels.size()]);
          qualifyValues=values.toArray(new Object[values.size()]);
        }
        ConditionalExpression filterCondExpr;
        if (ModuleUtil.isListFilterValue(filterCon)) {
          filterCondExpr=new ConditionalExpression(modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.EXPR_PROP).getValue()),DataAdapterUtil.adaptModelFilterOperator(filterCon.getOperator()),filterCon.getValue1ExpressionList().getListValue());
        }
 else {
          Expression value1=null;
          List<Expression> val1list=filterCon.getValue1ExpressionList().getListValue();
          if (val1list != null && val1list.size() > 0) {
            value1=val1list.get(0);
          }
          filterCondExpr=new ConditionalExpression(modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.EXPR_PROP).getValue()),DataAdapterUtil.adaptModelFilterOperator(filterCon.getOperator()),modelAdapter.adaptExpression(value1),modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.VALUE2_PROP).getValue()));
        }
        ICubeFilterDefinition filterDef=getCubeElementFactory().creatCubeFilterDefinition(filterCondExpr,levelMapping.get(lv.getCubeLevel()),qualifyLevels,qualifyValues);
        cubeQuery.addFilter(filterDef);
      }
    }
  }
}

Fixed version (ground truth):
private static void addLevelFilter(List<LevelViewHandle> levelViews,Map<LevelHandle,ILevelDefinition> levelMapping,ICubeQueryDefinition cubeQuery,IModelAdapter modelAdapter) throws BirtException {
  List<ILevelDefinition> levels=new ArrayList<ILevelDefinition>();
  List<Object> values=new ArrayList<Object>();
  for (Iterator<LevelViewHandle> itr=levelViews.iterator(); itr.hasNext(); ) {
    LevelViewHandle lv=itr.next();
    Iterator filterItr=lv.filtersIterator();
    if (filterItr != null) {
      while (filterItr.hasNext()) {
        FilterConditionElementHandle filterCon=(FilterConditionElementHandle)filterItr.next();
        levels.clear();
        values.clear();
        addMembers(levelMapping,levels,values,filterCon.getMember());
        ILevelDefinition[] qualifyLevels=null;
        Object[] qualifyValues=null;
        if (levels.size() > 0) {
          qualifyLevels=levels.toArray(new ILevelDefinition[levels.size()]);
          qualifyValues=values.toArray(new Object[values.size()]);
        }
        ConditionalExpression filterCondExpr;
        if (ModuleUtil.isListFilterValue(filterCon)) {
          filterCondExpr=new ConditionalExpression(modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.EXPR_PROP).getValue(),ExpressionLocation.CUBE),DataAdapterUtil.adaptModelFilterOperator(filterCon.getOperator()),filterCon.getValue1ExpressionList().getListValue());
        }
 else {
          Expression value1=null;
          List<Expression> val1list=filterCon.getValue1ExpressionList().getListValue();
          if (val1list != null && val1list.size() > 0) {
            value1=val1list.get(0);
          }
          filterCondExpr=new ConditionalExpression(modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.EXPR_PROP).getValue(),ExpressionLocation.CUBE),DataAdapterUtil.adaptModelFilterOperator(filterCon.getOperator()),modelAdapter.adaptExpression(value1,ExpressionLocation.CUBE),modelAdapter.adaptExpression((Expression)filterCon.getExpressionProperty(IFilterConditionElementModel.VALUE2_PROP).getValue(),ExpressionLocation.CUBE));
        }
        ICubeFilterDefinition filterDef=getCubeElementFactory().creatCubeFilterDefinition(filterCondExpr,levelMapping.get(lv.getCubeLevel()),qualifyLevels,qualifyValues);
        cubeQuery.addFilter(filterDef);
      }
    }
  }
}