Program: 52947
Project: 52947
Buggy source:
private TIntSet getContainedItemIds(Geometry g,String refSysName,Set<String> subLayers,ContainmentOperationType opType) throws DaoException {
  if (subLayers.size() == 0)   throw new DaoException("String_Node_Str");
  FilterFactory2 ff=CommonFactoryFinder.getFilterFactory2();
  PropertyName geomProperty=ff.property(db.getGeometryAttributeName());
  PropertyName refSysProperty=ff.property(db.getRefSysAttributeName());
  Filter refSysFilter=ff.equals(refSysProperty,ff.literal(refSysName));
  PropertyName layerProperty=ff.property(db.getLayerAttributeName());
  List<Filter> layerFilters=Lists.newArrayList();
  for (  String subLayer : subLayers) {
    Filter curLayerFilter=ff.equals(layerProperty,ff.literal(subLayer));
    layerFilters.add(curLayerFilter);
  }
  Filter layerFilter=ff.and(layerFilters);
  Filter geomFilter=null;
switch (opType) {
case CONTAINMENT:
    geomFilter=ff.contains(geomProperty,ff.literal(g));
  break;
case INTERSECTION:
geomFilter=ff.intersects(geomProperty,ff.literal(g));
break;
default :
throw new DaoException("String_Node_Str" + opType);
}
List<Filter> filters=Lists.newArrayList();
filters.add(refSysFilter);
filters.add(layerFilter);
filters.add(geomFilter);
Filter finalFilter=ff.and(filters);
try {
FeatureSource featureSource=db.getFeatureSource();
FeatureCollection containedFeatures=featureSource.getFeatures(finalFilter);
FeatureIterator featureIterator=containedFeatures.features();
TIntSet rVal=new TIntHashSet();
while (featureIterator.hasNext()) {
Feature f=featureIterator.next();
Integer itemId=(Integer)f.getProperty(db.getItemIdAttributeName()).getValue();
rVal.add(itemId);
}
return rVal;
}
 catch (IOException e) {
throw new DaoException(e);
}
}

Fixed version (ground truth):
@Override public TIntSet getContainedItemIds(Geometry g,String refSysName,Set<String> subLayers,ContainmentOperationType opType) throws DaoException {
  if (subLayers.size() == 0)   throw new DaoException("String_Node_Str");
  FilterFactory2 ff=CommonFactoryFinder.getFilterFactory2();
  PropertyName geomProperty=ff.property(db.getGeometryAttributeName());
  PropertyName refSysProperty=ff.property(db.getRefSysAttributeName());
  Filter refSysFilter=ff.equals(refSysProperty,ff.literal(refSysName));
  PropertyName layerProperty=ff.property(db.getLayerAttributeName());
  List<Filter> layerFilters=Lists.newArrayList();
  for (  String subLayer : subLayers) {
    Filter curLayerFilter=ff.equals(layerProperty,ff.literal(subLayer));
    layerFilters.add(curLayerFilter);
  }
  Filter layerFilter=ff.and(layerFilters);
  Filter geomFilter=null;
switch (opType) {
case CONTAINMENT:
    geomFilter=ff.contains(geomProperty,ff.literal(g));
  break;
case INTERSECTION:
geomFilter=ff.intersects(geomProperty,ff.literal(g));
break;
default :
throw new DaoException("String_Node_Str" + opType);
}
List<Filter> filters=Lists.newArrayList();
filters.add(refSysFilter);
filters.add(layerFilter);
filters.add(geomFilter);
Filter finalFilter=ff.and(filters);
try {
FeatureSource featureSource=db.getFeatureSource();
FeatureCollection containedFeatures=featureSource.getFeatures(finalFilter);
FeatureIterator featureIterator=containedFeatures.features();
TIntSet rVal=new TIntHashSet();
while (featureIterator.hasNext()) {
Feature f=featureIterator.next();
Integer itemId=(Integer)f.getProperty(db.getItemIdAttributeName()).getValue();
rVal.add(itemId);
}
return rVal;
}
 catch (IOException e) {
throw new DaoException(e);
}
}