Program: 168904
Project: 168904
Buggy source:
private Query getValuesExampleQuery(Class<?> clazz,String prefix,String treatFunction,String castedParameter,Set<Attribute<?,?>> attributeSet,String[][] parameterNames,ValueRetriever<?,?>[] pathExpressions,StringBuilder valuesSb,ValuesStrategy strategy,String dummyTable){
  int valueCount=parameterNames.length;
  String[] attributes=new String[attributeSet.size()];
  String[] attributeParameter=new String[attributeSet.size()];
  StringBuilder sb=new StringBuilder(50 + valueCount * prefix.length() * attributeSet.size()* 50);
  sb.append("String_Node_Str");
  if (clazz == ValuesEntity.class) {
    sb.append("String_Node_Str");
    attributes[0]=attributeSet.iterator().next().getName();
    attributeParameter[0]=castedParameter;
    pathExpressions[0]=new SimpleValueRetriever();
    sb.append(attributes[0]);
    sb.append(',');
  }
 else {
    Iterator<Attribute<?,?>> iter=attributeSet.iterator();
    for (int i=0; i < attributes.length; i++) {
      sb.append("String_Node_Str");
      Attribute<?,?> attribute=iter.next();
      attributes[i]=attribute.getName();
      attributeParameter[i]=mainQuery.dbmsDialect.cast("String_Node_Str",mainQuery.jpaProvider.getColumnType(attribute));
      pathExpressions[i]=com.blazebit.reflection.ExpressionUtils.getExpression(clazz,attributes[i]);
      sb.append(attributes[i]);
      sb.append(',');
    }
  }
  sb.setCharAt(sb.length() - 1,' ');
  sb.append("String_Node_Str");
  sb.append(clazz.getName());
  sb.append("String_Node_Str");
  if (strategy == ValuesStrategy.SELECT_VALUES || strategy == ValuesStrategy.VALUES) {
    valuesSb.append("String_Node_Str");
  }
 else   if (strategy == ValuesStrategy.SELECT_UNION) {
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + strategy);
  }
  for (int i=0; i < valueCount; i++) {
    if (strategy == ValuesStrategy.SELECT_UNION) {
      valuesSb.append("String_Node_Str");
    }
 else {
      valuesSb.append('(');
    }
    for (int j=0; j < attributes.length; j++) {
      sb.append("String_Node_Str");
      if (treatFunction != null) {
        sb.append(treatFunction);
        sb.append('(');
        sb.append("String_Node_Str");
        sb.append(attributes[j]);
        sb.append(')');
      }
 else {
        sb.append("String_Node_Str");
        sb.append(attributes[j]);
      }
      sb.append("String_Node_Str");
      sb.append(':');
      int start=sb.length();
      sb.append(prefix);
      sb.append('_');
      sb.append(attributes[j]);
      sb.append('_').append(i);
      String paramName=sb.substring(start,sb.length());
      parameterNames[i][j]=paramName;
      valuesSb.append(attributeParameter[j]);
      valuesSb.append(',');
    }
    if (strategy == ValuesStrategy.SELECT_UNION) {
      valuesSb.setCharAt(valuesSb.length() - 1,' ');
      if (dummyTable != null) {
        valuesSb.append("String_Node_Str");
        valuesSb.append(dummyTable);
      }
    }
 else {
      valuesSb.setCharAt(valuesSb.length() - 1,')');
      valuesSb.append(',');
    }
  }
  if (strategy == ValuesStrategy.SELECT_UNION) {
    valuesSb.setCharAt(valuesSb.length() - 1,' ');
  }
 else {
    valuesSb.setCharAt(valuesSb.length() - 1,')');
  }
  String exampleQueryString=sb.toString();
  Query q=mainQuery.em.createQuery(exampleQueryString);
  return q;
}

Fixed version (ground truth):
private Query getValuesExampleQuery(Class<?> clazz,String prefix,String treatFunction,String castedParameter,Set<Attribute<?,?>> attributeSet,String[][] parameterNames,ValueRetriever<?,?>[] pathExpressions,StringBuilder valuesSb,ValuesStrategy strategy,String dummyTable){
  int valueCount=parameterNames.length;
  String[] attributes=new String[attributeSet.size()];
  String[] attributeParameter=new String[attributeSet.size()];
  StringBuilder sb=new StringBuilder(50 + valueCount * prefix.length() * attributeSet.size()* 50);
  sb.append("String_Node_Str");
  if (clazz == ValuesEntity.class) {
    sb.append("String_Node_Str");
    attributes[0]=attributeSet.iterator().next().getName();
    attributeParameter[0]=mainQuery.dbmsDialect.needsCastParameters() ? castedParameter : "String_Node_Str";
    pathExpressions[0]=new SimpleValueRetriever();
    sb.append(attributes[0]);
    sb.append(',');
  }
 else {
    Iterator<Attribute<?,?>> iter=attributeSet.iterator();
    for (int i=0; i < attributes.length; i++) {
      sb.append("String_Node_Str");
      Attribute<?,?> attribute=iter.next();
      attributes[i]=attribute.getName();
      attributeParameter[i]=mainQuery.dbmsDialect.needsCastParameters() ? mainQuery.dbmsDialect.cast("String_Node_Str",mainQuery.jpaProvider.getColumnType(attribute)) : "String_Node_Str";
      pathExpressions[i]=com.blazebit.reflection.ExpressionUtils.getExpression(clazz,attributes[i]);
      sb.append(attributes[i]);
      sb.append(',');
    }
  }
  sb.setCharAt(sb.length() - 1,' ');
  sb.append("String_Node_Str");
  sb.append(clazz.getName());
  sb.append("String_Node_Str");
  if (strategy == ValuesStrategy.SELECT_VALUES || strategy == ValuesStrategy.VALUES) {
    valuesSb.append("String_Node_Str");
  }
 else   if (strategy == ValuesStrategy.SELECT_UNION) {
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + strategy);
  }
  for (int i=0; i < valueCount; i++) {
    if (strategy == ValuesStrategy.SELECT_UNION) {
      valuesSb.append("String_Node_Str");
    }
 else {
      valuesSb.append('(');
    }
    for (int j=0; j < attributes.length; j++) {
      sb.append("String_Node_Str");
      if (treatFunction != null) {
        sb.append(treatFunction);
        sb.append('(');
        sb.append("String_Node_Str");
        sb.append(attributes[j]);
        sb.append(')');
      }
 else {
        sb.append("String_Node_Str");
        sb.append(attributes[j]);
      }
      sb.append("String_Node_Str");
      sb.append(':');
      int start=sb.length();
      sb.append(prefix);
      sb.append('_');
      sb.append(attributes[j]);
      sb.append('_').append(i);
      String paramName=sb.substring(start,sb.length());
      parameterNames[i][j]=paramName;
      valuesSb.append(attributeParameter[j]);
      valuesSb.append(',');
    }
    if (strategy == ValuesStrategy.SELECT_UNION) {
      valuesSb.setCharAt(valuesSb.length() - 1,' ');
      if (dummyTable != null) {
        valuesSb.append("String_Node_Str");
        valuesSb.append(dummyTable);
      }
    }
 else {
      valuesSb.setCharAt(valuesSb.length() - 1,')');
      valuesSb.append(',');
    }
  }
  if (strategy == ValuesStrategy.SELECT_UNION) {
    valuesSb.setCharAt(valuesSb.length() - 1,' ');
  }
 else {
    valuesSb.setCharAt(valuesSb.length() - 1,')');
  }
  String exampleQueryString=sb.toString();
  Query q=mainQuery.em.createQuery(exampleQueryString);
  return q;
}