Program: 38705
Project: 38705
Buggy source:
public Set<User> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<User> foundSet=new HashSet<User>();
  if (constraints == null || constraints.isEmpty()) {
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  Iterator<QueryConstraint> iter=constraints.iterator();
  while (iter.hasNext()) {
    QueryConstraint constraint=iter.next();
    Enum field=constraint.getField();
    IQueryOperator operator=constraint.getOperator();
    statementString.append(field).append(operator.getSqlStatement());
    if (iter.hasNext()) {
      statementString.append("String_Node_Str");
    }
  }
  if (ids != null && !ids.isEmpty())   statementString.append("String_Node_Str" + getIdSetCondition(ids));
  statementString.append("String_Node_Str");
  PreparedStatement preparedStatement=getPreparedStatement(statementString.toString());
  int index=0;
  for (  QueryConstraint constraint : constraints) {
    User._Fields field=(User._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case handle:
          preparedStatement.setString(++index,(String)parameter);
        break;
case created_at_millis:
      preparedStatement.setLong(++index,(Long)parameter);
    break;
case num_posts:
  preparedStatement.setInt(++index,(Integer)parameter);
break;
case some_date:
preparedStatement.setDate(++index,new Date((Long)parameter));
break;
case some_datetime:
preparedStatement.setTimestamp(++index,new Timestamp((Long)parameter));
break;
case bio:
preparedStatement.setString(++index,(String)parameter);
break;
case some_binary:
preparedStatement.setBytes(++index,(byte[])parameter);
break;
case some_float:
preparedStatement.setDouble(++index,(Double)parameter);
break;
case some_decimal:
preparedStatement.setDouble(++index,(Double)parameter);
break;
case some_boolean:
preparedStatement.setBoolean(++index,(Boolean)parameter);
break;
}
}
 catch (SQLException e) {
throw new IOException(e);
}
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}

Fixed version (ground truth):
public Set<User> find(ModelQuery query) throws IOException {
  Set<User> foundSet=new HashSet<User>();
  if (query.getConstraints() == null || query.getConstraints().isEmpty()) {
    Set<Long> ids=query.getIdSet();
    if (ids != null && !ids.isEmpty()) {
      return find(ids);
    }
    return foundSet;
  }
  StringBuilder statementString=new StringBuilder();
  statementString.append("String_Node_Str");
  statementString.append(query.getSqlStatement());
  statementString.append("String_Node_Str");
  PreparedStatement preparedStatement=getPreparedStatement(statementString.toString());
  int index=0;
  for (  QueryConstraint constraint : query.getConstraints()) {
    User._Fields field=(User._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case handle:
          preparedStatement.setString(++index,(String)parameter);
        break;
case created_at_millis:
      preparedStatement.setLong(++index,(Long)parameter);
    break;
case num_posts:
  preparedStatement.setInt(++index,(Integer)parameter);
break;
case some_date:
preparedStatement.setDate(++index,new Date((Long)parameter));
break;
case some_datetime:
preparedStatement.setTimestamp(++index,new Timestamp((Long)parameter));
break;
case bio:
preparedStatement.setString(++index,(String)parameter);
break;
case some_binary:
preparedStatement.setBytes(++index,(byte[])parameter);
break;
case some_float:
preparedStatement.setDouble(++index,(Double)parameter);
break;
case some_decimal:
preparedStatement.setDouble(++index,(Double)parameter);
break;
case some_boolean:
preparedStatement.setBoolean(++index,(Boolean)parameter);
break;
}
}
 catch (SQLException e) {
throw new IOException(e);
}
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}