Program: 11168
Project: 11168
Buggy source:
private String getWhereClause(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  int count=0;
  for (  Relation relation : where) {
    if (count > 0) {
      sb.append("String_Node_Str");
    }
    count=1;
switch (relation.getOperator()) {
case IN:
case BETWEEN:
      break;
case MATCH:
    if (luceneIndexExist) {
      luceneIndex.append("String_Node_Str");
    }
  luceneIndex.append(getLuceneWhereClause(relation));
luceneIndexExist=true;
break;
default :
Selector right=relation.getRightTerm();
if (right instanceof FunctionSelector) {
FunctionSelector function=(FunctionSelector)right;
if ("String_Node_Str".equals(function.getFunctionName())) {
getStringRangeFunction(function,(ColumnSelector)relation.getLeftTerm());
}
 else {
ColumnSelector left=(ColumnSelector)relation.getLeftTerm();
String column=Utils.toCaseSensitive(left.getColumnName().getName());
sb.append(column).append("String_Node_Str").append(relation.getOperator().toString()).append("String_Node_Str");
sb.append(function.toString());
}
}
 else {
ColumnSelector left=(ColumnSelector)relation.getLeftTerm();
String column=Utils.toCaseSensitive(left.getColumnName().getName());
sb.append(column).append("String_Node_Str").append(relation.getOperator().toString()).append("String_Node_Str");
sb.append(right.toString());
}
break;
}
}
if (luceneIndexExist) {
String nameIndex=getLuceneIndex();
StringBuilder sbLucene=new StringBuilder();
sbLucene.append(Utils.toCaseSensitive(nameIndex)).append("String_Node_Str");
sbLucene.append(luceneIndex).append("String_Node_Str");
sb.append(sbLucene);
}
String whereClause=sb.toString();
while (whereClause.contains("String_Node_Str")) {
whereClause=whereClause.replace("String_Node_Str","String_Node_Str");
}
return whereClause;
}

Fixed version (ground truth):
private String getWhereClause(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  int count=0;
  for (  Relation relation : where) {
    if (count > 0) {
      sb.append("String_Node_Str");
    }
    count=1;
switch (relation.getOperator()) {
case IN:
case BETWEEN:
      break;
case MATCH:
    if (luceneIndexExist) {
      luceneIndex.append("String_Node_Str");
    }
  luceneIndex.append(getLuceneWhereClause(relation));
luceneIndexExist=true;
break;
default :
Selector right=relation.getRightTerm();
if (right instanceof FunctionSelector) {
FunctionSelector function=(FunctionSelector)right;
if ("String_Node_Str".equals(function.getFunctionName())) {
getStringRangeFunction(function,(ColumnSelector)relation.getLeftTerm());
}
 else {
ColumnSelector left=(ColumnSelector)relation.getLeftTerm();
String column=Utils.toCaseSensitive(left.getColumnName().getName());
sb.append(column).append("String_Node_Str").append(relation.getOperator().toString()).append("String_Node_Str");
sb.append(function.toString());
}
}
 else {
ColumnSelector left=(ColumnSelector)relation.getLeftTerm();
String column=Utils.toCaseSensitive(left.getColumnName().getName());
sb.append(column).append("String_Node_Str").append(relation.getOperator().toString()).append("String_Node_Str");
sb.append(Utils.getFormatType(left,right,session));
}
break;
}
}
if (luceneIndexExist) {
String nameIndex=getLuceneIndex();
StringBuilder sbLucene=new StringBuilder();
sbLucene.append(Utils.toCaseSensitive(nameIndex)).append("String_Node_Str");
sbLucene.append(luceneIndex).append("String_Node_Str");
sb.append(sbLucene);
}
String whereClause=sb.toString();
while (whereClause.contains("String_Node_Str")) {
whereClause=whereClause.replace("String_Node_Str","String_Node_Str");
}
return whereClause;
}