Program: 24462
Project: 24462
Buggy source:
protected QueryByFilter buildQueryByFilter(QueryByExample iQuery){
  QueryByFilter filter=new QueryByFilter(iQuery.getCandidateClass());
  filter.setRangeFrom(iQuery.getRangeFrom(),iQuery.getRangeTo());
  filter.setSubClasses(iQuery.isSubClasses());
  filter.setMode(iQuery.getMode());
  filter.setStrategy(iQuery.getStrategy());
  if (iQuery.getFilter() != null) {
    Iterator<SchemaField> sf=Roma.schema().getSchemaClass(iQuery.getCandidateClass()).getFieldIterator();
    Object fieldValue;
    QueryOperator operator=null;
    while (sf.hasNext()) {
      SchemaField field=sf.next();
      try {
        boolean found=false;
        Field[] fields=iQuery.getCandidateClass().getFields();
        for (        Field classField : fields) {
          if (classField.getName().equals(field.getName())) {
            found=true;
            break;
          }
        }
        if (!found)         continue;
      }
 catch (      SecurityException e) {
      }
      fieldValue=field.getValue(iQuery.getFilter());
      if (fieldValue != null) {
        if (fieldValue instanceof Collection<?> || fieldValue instanceof Map<?,?>)         continue;
        if (fieldValue instanceof String && ((String)fieldValue).length() == 0)         continue;
        if (String.class.equals(field.getLanguageType()))         operator=QueryByFilter.FIELD_LIKE;
 else         operator=QueryByFilter.FIELD_EQUALS;
        filter.addItem(field.getName(),operator,fieldValue);
      }
    }
  }
  QueryByFilter addFilter=iQuery.getAdditionalFilter();
  if (addFilter != null) {
    filter.setSubClasses(addFilter.isSubClasses());
    filter.merge(addFilter);
  }
  return filter;
}

Fixed version (ground truth):
protected QueryByFilter buildQueryByFilter(QueryByExample iQuery){
  QueryByFilter filter=new QueryByFilter(iQuery.getCandidateClass());
  filter.setRangeFrom(iQuery.getRangeFrom(),iQuery.getRangeTo());
  filter.setSubClasses(iQuery.isSubClasses());
  filter.setMode(iQuery.getMode());
  filter.setStrategy(iQuery.getStrategy());
  if (iQuery.getFilter() != null) {
    Iterator<SchemaField> sf=Roma.schema().getSchemaClass(iQuery.getCandidateClass()).getFieldIterator();
    Object fieldValue;
    QueryOperator operator=null;
    while (sf.hasNext()) {
      SchemaField field=sf.next();
      try {
        boolean found=false;
        Field[] fields=iQuery.getCandidateClass().getDeclaredFields();
        for (        Field classField : fields) {
          if (classField.getName().equals(field.getName())) {
            found=true;
            break;
          }
        }
        if (!found)         continue;
      }
 catch (      SecurityException e) {
      }
      fieldValue=field.getValue(iQuery.getFilter());
      if (fieldValue != null) {
        if (fieldValue instanceof Collection<?> || fieldValue instanceof Map<?,?>)         continue;
        if (fieldValue instanceof String && ((String)fieldValue).length() == 0)         continue;
        if (String.class.equals(field.getLanguageType()))         operator=QueryByFilter.FIELD_LIKE;
 else         operator=QueryByFilter.FIELD_EQUALS;
        filter.addItem(field.getName(),operator,fieldValue);
      }
    }
  }
  QueryByFilter addFilter=iQuery.getAdditionalFilter();
  if (addFilter != null) {
    filter.setSubClasses(addFilter.isSubClasses());
    filter.merge(addFilter);
  }
  return filter;
}