Program: 51430
Project: 51430
Buggy source:
/** 
 * What one wants to determine is for each individual Members of the input parameter list whether across a slice there is any data. But what data. For other Members, the default Member is used, but for Measures one should look for that data for all Measures associated with the query, not just one Measure. For a dense dataset this may not be a problem or even apparent, but for a sparse dataset, the first Measure may, in fact, have not data but other Measures associated with the query might. Hence, the solution here is to identify all Measures associated with the query and then for each Member of the list, determine if there is any data iterating across all Measures until non-null data is found or the end of the Measures is reached.
 * @param evaluator evaluator
 * @param list list of members being checked for non-emptiness
 * @param call the cross join function call
 */
protected static List nonEmptyList(Evaluator evaluator,List list,ResolvedFunCall call){
  if (list.isEmpty()) {
    return list;
  }
  List result=new ArrayList((list.size() + 2) >> 1);
  Query query=evaluator.getQuery();
  Set<Member> measureSet=null;
  Set<Member> queryMeasureSet=query.getMeasuresMembers();
  if (queryMeasureSet.size() > 0) {
    MeasureVisitor visitor=new MeasureVisitor(queryMeasureSet,call);
    QueryAxis[] axes=query.getAxes();
    QueryAxis slicerAxis=query.getSlicerAxis();
    if (slicerAxis != null) {
      slicerAxis.accept(visitor);
    }
    if (visitor.measureSet != null) {
      measureSet=visitor.measureSet;
    }
 else     if (axes.length > 1) {
      for (int i=0; i < axes.length; i++) {
        if (axes[i] != null) {
          axes[i].accept(visitor);
        }
      }
      measureSet=visitor.measureSet;
    }
  }
  evaluator=evaluator.push();
  if (list.get(0) instanceof Member[]) {
    for (    Member[] ms : ((List<Member[]>)list)) {
      evaluator.setContext(ms);
      if (measureSet == null) {
        Object value=evaluator.evaluateCurrent();
        if (value != null && !(value instanceof Throwable)) {
          result.add(ms);
        }
      }
 else {
        Iterator<Member> measureIter=measureSet.iterator();
        MEASURES_LOOP:         while (measureIter.hasNext()) {
          Member measure=measureIter.next();
          evaluator.setContext(measure);
          Object value=evaluator.evaluateCurrent();
          if (value != null && !(value instanceof Throwable)) {
            result.add(ms);
            break MEASURES_LOOP;
          }
        }
      }
    }
  }
 else {
    for (Iterator listItr=list.iterator(); listItr.hasNext(); ) {
      Member m=(Member)listItr.next();
      evaluator.setContext(m);
      if (measureSet == null) {
        Object value=evaluator.evaluateCurrent();
        if (value != null && !(value instanceof Throwable)) {
          result.add(m);
        }
      }
 else {
        Iterator<Member> measureIter=measureSet.iterator();
        measuresLoop:         while (measureIter.hasNext()) {
          Member measure=measureIter.next();
          evaluator.setContext(measure);
          Object value=evaluator.evaluateCurrent();
          if (value != null && !(value instanceof Throwable)) {
            result.add(m);
            break measuresLoop;
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * What one wants to determine is for each individual Members of the input parameter list whether across a slice there is any data. But what data. For other Members, the default Member is used, but for Measures one should look for that data for all Measures associated with the query, not just one Measure. For a dense dataset this may not be a problem or even apparent, but for a sparse dataset, the first Measure may, in fact, have not data but other Measures associated with the query might. Hence, the solution here is to identify all Measures associated with the query and then for each Member of the list, determine if there is any data iterating across all Measures until non-null data is found or the end of the Measures is reached.
 * @param evaluator evaluator
 * @param list list of members being checked for non-emptiness
 * @param call the cross join function call
 */
protected static List nonEmptyList(Evaluator evaluator,List list,ResolvedFunCall call){
  if (list.isEmpty()) {
    return list;
  }
  List result=new ArrayList((list.size() + 2) >> 1);
  Query query=evaluator.getQuery();
  Set<Member> measureSet=null;
  Set<Member> queryMeasureSet=query.getMeasuresMembers();
  if (queryMeasureSet.size() > 0) {
    MeasureVisitor visitor=new MeasureVisitor(queryMeasureSet,call);
    QueryAxis[] axes=query.getAxes();
    QueryAxis slicerAxis=query.getSlicerAxis();
    if (slicerAxis != null) {
      slicerAxis.accept(visitor);
    }
    if (visitor.measureSet != null) {
      measureSet=visitor.measureSet;
    }
 else     if (axes.length > 0) {
      for (int i=0; i < axes.length; i++) {
        if (axes[i] != null) {
          axes[i].accept(visitor);
        }
      }
      measureSet=visitor.measureSet;
    }
  }
  evaluator=evaluator.push();
  if (list.get(0) instanceof Member[]) {
    for (    Member[] ms : ((List<Member[]>)list)) {
      evaluator.setContext(ms);
      if (measureSet == null) {
        Object value=evaluator.evaluateCurrent();
        if (value != null && !(value instanceof Throwable)) {
          result.add(ms);
        }
      }
 else {
        Iterator<Member> measureIter=measureSet.iterator();
        MEASURES_LOOP:         while (measureIter.hasNext()) {
          Member measure=measureIter.next();
          evaluator.setContext(measure);
          Object value=evaluator.evaluateCurrent();
          if (value != null && !(value instanceof Throwable)) {
            result.add(ms);
            break MEASURES_LOOP;
          }
        }
      }
    }
  }
 else {
    for (Iterator listItr=list.iterator(); listItr.hasNext(); ) {
      Member m=(Member)listItr.next();
      evaluator.setContext(m);
      if (measureSet == null) {
        Object value=evaluator.evaluateCurrent();
        if (value != null && !(value instanceof Throwable)) {
          result.add(m);
        }
      }
 else {
        Iterator<Member> measureIter=measureSet.iterator();
        measuresLoop:         while (measureIter.hasNext()) {
          Member measure=measureIter.next();
          evaluator.setContext(measure);
          Object value=evaluator.evaluateCurrent();
          if (value != null && !(value instanceof Throwable)) {
            result.add(m);
            break measuresLoop;
          }
        }
      }
    }
  }
  return result;
}