Program: 24463
Project: 24463
Buggy source:
public void buildWhere(StringBuilder where,List<QueryByFilterItem> items,Map<String,Object> params,String predicate,String alias,Map<String,Class<?>> froms,Map<String,List<QueryByFilterProjection>> projections){
  if (items == null)   return;
  Iterator<QueryByFilterItem> iter=items.iterator();
  char aliasAppend='A';
  while (iter.hasNext()) {
    QueryByFilterItem item=iter.next();
    if (item instanceof QueryByFilterItemGroup) {
      if (((QueryByFilterItemGroup)item).getItems() == null && ((QueryByFilterItemGroup)item).getItems().isEmpty())       continue;
      where.append("String_Node_Str");
      buildWhere(where,((QueryByFilterItemGroup)item).getItems(),params,((QueryByFilterItemGroup)item).getPredicate(),alias,froms,projections);
      where.append("String_Node_Str");
    }
 else     if (item instanceof QueryByFilterItemPredicate) {
      QueryByFilterItemPredicate pred=((QueryByFilterItemPredicate)item);
      String fieldName=pred.getFieldName();
      where.append(alias).append("String_Node_Str").append(fieldName);
      where.append(getJPQLOperator(pred.getFieldOperator()));
      String pName=fieldName.replace('.','_');
      int i=1;
      while (params.get(pName) != null)       pName=fieldName.replace('.','_') + (i++);
      if (QueryOperator.LIKE.equals(pred.getFieldOperator()) && (pred.getFieldValue() instanceof String) || pred.getFieldValue() == null) {
        String value=(String)pred.getFieldValue();
        if (value == null)         params.put(pName,"String_Node_Str");
 else {
          if (value.indexOf("String_Node_Str") != -1)           params.put(pName,value.toUpperCase().replaceAll("String_Node_Str","String_Node_Str"));
 else           params.put(pName,"String_Node_Str" + value.toUpperCase() + "String_Node_Str");
        }
      }
 else       params.put(pName,pred.getFieldValue());
      where.append(':').append(pName);
    }
 else     if (item instanceof QueryByFilterItemText) {
      where.append(alias).append("String_Node_Str").append(((QueryByFilterItemText)item).getCondition());
    }
 else     if (item instanceof QueryByFilterItemReverse) {
      String field=((QueryByFilterItemReverse)item).getField();
      String newAlias=alias + (aliasAppend++);
      where.append(newAlias).append("String_Node_Str").append(field);
      where.append(getJPQLOperator(((QueryByFilterItemReverse)item).getOperator()));
      where.append(alias);
      QueryByFilter qbf=((QueryByFilterItemReverse)item).getQueryByFilter();
      froms.put(newAlias,qbf.getCandidateClass());
      projections.put(newAlias,qbf.getProjections());
      if (qbf.getItems().size() > 0) {
        where.append("String_Node_Str").append(predicate).append("String_Node_Str");
      }
      buildWhere(where,qbf.getItems(),params,qbf.getPredicateOperator(),newAlias,froms,projections);
    }
    if (iter.hasNext())     where.append("String_Node_Str").append(predicate).append("String_Node_Str");
  }
}

Fixed version (ground truth):
public void buildWhere(StringBuilder where,List<QueryByFilterItem> items,Map<String,Object> params,String predicate,String alias,Map<String,Class<?>> froms,Map<String,List<QueryByFilterProjection>> projections){
  if (items == null)   return;
  Iterator<QueryByFilterItem> iter=items.iterator();
  char aliasAppend='A';
  while (iter.hasNext()) {
    QueryByFilterItem item=iter.next();
    if (item instanceof QueryByFilterItemGroup) {
      if (((QueryByFilterItemGroup)item).getItems() == null && ((QueryByFilterItemGroup)item).getItems().isEmpty())       continue;
      where.append("String_Node_Str");
      buildWhere(where,((QueryByFilterItemGroup)item).getItems(),params,((QueryByFilterItemGroup)item).getPredicate(),alias,froms,projections);
      where.append("String_Node_Str");
    }
 else     if (item instanceof QueryByFilterItemPredicate) {
      QueryByFilterItemPredicate pred=((QueryByFilterItemPredicate)item);
      String fieldName=pred.getFieldName();
      where.append(alias).append("String_Node_Str").append(fieldName);
      where.append(getJPQLOperator(pred.getFieldOperator()));
      String pName=fieldName.replace('.','_');
      int i=1;
      while (params.get(pName) != null)       pName=fieldName.replace('.','_') + (i++);
      if (QueryOperator.LIKE.equals(pred.getFieldOperator()) && ((pred.getFieldValue() instanceof String) || pred.getFieldValue() == null)) {
        String value=(String)pred.getFieldValue();
        if (value == null)         params.put(pName,"String_Node_Str");
 else {
          if (value.indexOf("String_Node_Str") != -1)           params.put(pName,value.toUpperCase().replaceAll("String_Node_Str","String_Node_Str"));
 else           params.put(pName,"String_Node_Str" + value.toUpperCase() + "String_Node_Str");
        }
      }
 else       params.put(pName,pred.getFieldValue());
      where.append(':').append(pName);
    }
 else     if (item instanceof QueryByFilterItemText) {
      where.append(alias).append("String_Node_Str").append(((QueryByFilterItemText)item).getCondition());
    }
 else     if (item instanceof QueryByFilterItemReverse) {
      String field=((QueryByFilterItemReverse)item).getField();
      String newAlias=alias + (aliasAppend++);
      where.append(newAlias).append("String_Node_Str").append(field);
      where.append(getJPQLOperator(((QueryByFilterItemReverse)item).getOperator()));
      where.append(alias);
      QueryByFilter qbf=((QueryByFilterItemReverse)item).getQueryByFilter();
      froms.put(newAlias,qbf.getCandidateClass());
      projections.put(newAlias,qbf.getProjections());
      if (qbf.getItems().size() > 0) {
        where.append("String_Node_Str").append(predicate).append("String_Node_Str");
      }
      buildWhere(where,qbf.getItems(),params,qbf.getPredicateOperator(),newAlias,froms,projections);
    }
    if (iter.hasNext())     where.append("String_Node_Str").append(predicate).append("String_Node_Str");
  }
}