Program: 49742
Project: 49742
Buggy source:
public Set<MapEntry> doQuery(QueryContext queryContext){
  boolean strong=false;
  Set<MapEntry> results=null;
  Predicate predicate=queryContext.getPredicate();
  try {
    if (predicate != null && mapIndexes != null && predicate instanceof IndexAwarePredicate) {
      List<IndexAwarePredicate> lsIndexAwarePredicates=new ArrayList<IndexAwarePredicate>();
      IndexAwarePredicate iap=(IndexAwarePredicate)predicate;
      strong=iap.collectIndexAwarePredicates(lsIndexAwarePredicates,mapIndexes);
      if (strong) {
        Set<Index> setAppliedIndexes=new HashSet<Index>(1);
        iap.collectAppliedIndexes(setAppliedIndexes,mapIndexes);
        if (setAppliedIndexes.size() > 0) {
          for (          Index index : setAppliedIndexes) {
            if (strong) {
              strong=index.isStrong();
            }
          }
        }
      }
      int indexAwarePredicateCount=lsIndexAwarePredicates.size();
      if (indexAwarePredicateCount == 1) {
        IndexAwarePredicate indexAwarePredicate=lsIndexAwarePredicates.get(0);
        Set<MapEntry> sub=indexAwarePredicate.filter(queryContext);
        if (sub == null || sub.size() == 0) {
          return null;
        }
 else {
          return sub;
        }
      }
 else       if (indexAwarePredicateCount > 0) {
        IndexAwarePredicate indexAwarePredicateFirst=lsIndexAwarePredicates.get(0);
        Set<MapEntry> subFirst=indexAwarePredicateFirst.filter(queryContext);
        if (subFirst != null && subFirst.size() < 11) {
          strong=true;
          Set<MapEntry> resultSet=new HashSet<MapEntry>(subFirst);
          for (int i=1; i < lsIndexAwarePredicates.size(); i++) {
            IndexAwarePredicate p=lsIndexAwarePredicates.get(i);
            Iterator<MapEntry> it=resultSet.iterator();
            while (it.hasNext()) {
              Record record=(Record)it.next();
              if (!p.apply(record)) {
                it.remove();
              }
            }
          }
          return resultSet;
        }
 else         if (subFirst != null) {
          List<Set<MapEntry>> lsSubResults=new ArrayList<Set<MapEntry>>(indexAwarePredicateCount);
          lsSubResults.add(subFirst);
          Set<MapEntry> smallestSet=subFirst;
          for (int i=1; i < indexAwarePredicateCount; i++) {
            IndexAwarePredicate p=lsIndexAwarePredicates.get(i);
            Set<MapEntry> sub=p.filter(queryContext);
            if (sub == null) {
              strong=false;
            }
 else             if (sub.size() == 0) {
              strong=true;
              return null;
            }
 else {
              if (sub.size() < smallestSet.size()) {
                smallestSet=sub;
              }
              lsSubResults.add(sub);
            }
          }
          if (smallestSet == null) {
            return null;
          }
          results=new HashSet<MapEntry>(smallestSet.size());
          Iterator<MapEntry> it=smallestSet.iterator();
          smallestLoop:           while (it.hasNext()) {
            MapEntry entry=it.next();
            for (            Set<MapEntry> sub : lsSubResults) {
              if (!sub.contains(entry)) {
                continue smallestLoop;
              }
            }
            results.add(entry);
          }
          return results;
        }
      }
    }
    return new SingleResultSet(records);
  }
  finally {
    queryContext.setStrong(strong);
  }
}

Fixed version (ground truth):
public Set<MapEntry> doQuery(QueryContext queryContext){
  boolean strong=false;
  Set<MapEntry> results;
  Predicate predicate=queryContext.getPredicate();
  try {
    if (predicate != null && mapIndexes != null && predicate instanceof IndexAwarePredicate) {
      List<IndexAwarePredicate> lsIndexAwarePredicates=new ArrayList<IndexAwarePredicate>();
      IndexAwarePredicate iap=(IndexAwarePredicate)predicate;
      strong=iap.collectIndexAwarePredicates(lsIndexAwarePredicates,mapIndexes);
      if (strong) {
        Set<Index> setAppliedIndexes=new HashSet<Index>(1);
        iap.collectAppliedIndexes(setAppliedIndexes,mapIndexes);
        if (setAppliedIndexes.size() > 0) {
          for (          Index index : setAppliedIndexes) {
            if (strong) {
              strong=index.isStrong();
            }
          }
        }
      }
      int indexAwarePredicateCount=lsIndexAwarePredicates.size();
      if (indexAwarePredicateCount == 1) {
        IndexAwarePredicate indexAwarePredicate=lsIndexAwarePredicates.get(0);
        Set<MapEntry> sub=indexAwarePredicate.filter(queryContext);
        if (sub == null || sub.size() == 0) {
          return null;
        }
 else {
          return sub;
        }
      }
 else       if (indexAwarePredicateCount > 0) {
        IndexAwarePredicate indexAwarePredicateFirst=lsIndexAwarePredicates.get(0);
        Set<MapEntry> subFirst=indexAwarePredicateFirst.filter(queryContext);
        if (subFirst != null && subFirst.size() < 11) {
          strong=true;
          Set<MapEntry> resultSet=new HashSet<MapEntry>(subFirst);
          for (int i=1; i < lsIndexAwarePredicates.size(); i++) {
            IndexAwarePredicate p=lsIndexAwarePredicates.get(i);
            Iterator<MapEntry> it=resultSet.iterator();
            while (it.hasNext()) {
              Record record=(Record)it.next();
              if (!p.apply(record)) {
                it.remove();
              }
            }
          }
          return resultSet;
        }
 else         if (subFirst != null) {
          List<Set<MapEntry>> lsSubResults=new ArrayList<Set<MapEntry>>(indexAwarePredicateCount);
          lsSubResults.add(subFirst);
          Set<MapEntry> smallestSet=subFirst;
          for (int i=1; i < indexAwarePredicateCount; i++) {
            IndexAwarePredicate p=lsIndexAwarePredicates.get(i);
            Set<MapEntry> sub=p.filter(queryContext);
            if (sub == null) {
              strong=false;
            }
 else             if (sub.size() == 0) {
              strong=true;
              return null;
            }
 else {
              if (sub.size() < smallestSet.size()) {
                smallestSet=sub;
              }
              lsSubResults.add(sub);
            }
          }
          if (smallestSet == null) {
            return null;
          }
          results=new HashSet<MapEntry>(smallestSet.size());
          Iterator<MapEntry> it=smallestSet.iterator();
          smallestLoop:           while (it.hasNext()) {
            MapEntry entry=it.next();
            for (            Set<MapEntry> sub : lsSubResults) {
              if (!sub.contains(entry)) {
                continue smallestLoop;
              }
            }
            results.add(entry);
          }
          return results;
        }
      }
    }
    return new SingleResultSet(records);
  }
  finally {
    queryContext.setStrong(strong);
  }
}