Program: 38704
Project: 38704
Buggy source:
public Set<Post> find(Set<Long> ids,List<QueryConstraint> constraints) throws IOException {
  Set<Post> foundSet=new HashSet<Post>();
  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) {
    Post._Fields field=(Post._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case title:
          preparedStatement.setString(++index,(String)parameter);
        break;
case posted_at_millis:
      preparedStatement.setDate(++index,new Date((Long)parameter));
    break;
case user_id:
  preparedStatement.setInt(++index,(Integer)parameter);
break;
case updated_at:
preparedStatement.setTimestamp(++index,new Timestamp((Long)parameter));
break;
}
}
 catch (SQLException e) {
throw new IOException(e);
}
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}

Fixed version (ground truth):
public Set<Post> find(ModelQuery query) throws IOException {
  Set<Post> foundSet=new HashSet<Post>();
  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()) {
    Post._Fields field=(Post._Fields)constraint.getField();
    for (    Object parameter : constraint.getParameters()) {
      if (parameter == null) {
        continue;
      }
      try {
switch (field) {
case title:
          preparedStatement.setString(++index,(String)parameter);
        break;
case posted_at_millis:
      preparedStatement.setDate(++index,new Date((Long)parameter));
    break;
case user_id:
  preparedStatement.setInt(++index,(Integer)parameter);
break;
case updated_at:
preparedStatement.setTimestamp(++index,new Timestamp((Long)parameter));
break;
}
}
 catch (SQLException e) {
throw new IOException(e);
}
}
}
executeQuery(foundSet,preparedStatement);
return foundSet;
}