Program: 98033
Project: 98033
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void applyQueryOnExtent(List<Object> ret,QueryAdvice qa){
  QueryTreeNode queryTree=qa.getQuery();
  Iterator<?> ext2;
  if (!ignoreCache) {
    ClientSessionCache cache=pm.getSession().internalGetCache();
    cache.persistReachableObjects();
  }
  if (qa.getIndex() != null) {
    ext2=pm.getSession().getPrimaryNode().readObjectFromIndex(qa.getIndex(),qa.getMin(),qa.getMax(),!ignoreCache);
    if (!ignoreCache) {
      ClientSessionCache cache=pm.getSession().internalGetCache();
      ArrayList<ZooPC> dirtyObjs=cache.getDirtyObjects();
      if (!dirtyObjs.isEmpty()) {
        QueryMergingIterator<ZooPC> qmi=new QueryMergingIterator();
        qmi.add((Iterator<ZooPC>)ext2);
        qmi.addColl(dirtyObjs);
        ext2=qmi;
      }
    }
  }
 else {
    if (ext != null) {
      ext2=ext.iterator();
    }
 else {
      ext2=new ExtentImpl(candCls,subClasses,pm,ignoreCache).iterator();
    }
  }
  if (ext != null && !subClasses) {
    while (ext2.hasNext()) {
      Object o=ext2.next();
      if (subClasses) {
        if (!candCls.isAssignableFrom(o.getClass())) {
          continue;
        }
      }
 else {
        if (candCls != o.getClass()) {
          continue;
        }
      }
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
 else {
    while (ext2.hasNext()) {
      Object o=ext2.next();
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
  if (ext2 instanceof CloseableIterator) {
    ((CloseableIterator)ext2).close();
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void applyQueryOnExtent(List<Object> ret,QueryAdvice qa){
  QueryTreeNode queryTree=qa.getQuery();
  Iterator<?> ext2;
  if (!ignoreCache) {
    ClientSessionCache cache=pm.getSession().internalGetCache();
    cache.persistReachableObjects();
  }
  if (qa.getIndex() != null) {
    ext2=pm.getSession().getPrimaryNode().readObjectFromIndex(qa.getIndex(),qa.getMin(),qa.getMax(),!ignoreCache);
    if (!ignoreCache) {
      ClientSessionCache cache=pm.getSession().internalGetCache();
      ArrayList<ZooPC> dirtyObjs=cache.getDirtyObjects();
      if (!dirtyObjs.isEmpty()) {
        QueryMergingIterator<ZooPC> qmi=new QueryMergingIterator();
        qmi.add((Iterator<ZooPC>)ext2);
        qmi.add(cache.iterator(candClsDef,subClasses,ObjectState.PERSISTENT_NEW));
        ext2=qmi;
      }
    }
  }
 else {
    if (ext != null) {
      ext2=ext.iterator();
    }
 else {
      ext2=new ExtentImpl(candCls,subClasses,pm,ignoreCache).iterator();
    }
  }
  if (ext != null && !subClasses) {
    while (ext2.hasNext()) {
      Object o=ext2.next();
      if (subClasses) {
        if (!candCls.isAssignableFrom(o.getClass())) {
          continue;
        }
      }
 else {
        if (candCls != o.getClass()) {
          continue;
        }
      }
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
 else {
    while (ext2.hasNext()) {
      Object o=ext2.next();
      boolean isMatch=queryTree.evaluate(o);
      if (isMatch) {
        ret.add(o);
      }
    }
  }
  if (ext2 instanceof CloseableIterator) {
    ((CloseableIterator)ext2).close();
  }
}