Program: 157846
Project: 157846
Buggy source:
public void buildQuery(QueryBuilder qb) throws SQLException {
  Where where=qb.where();
  where.eq("String_Node_Str",false);
  where.eq("String_Node_Str",false);
  int clausesCount=2;
  if (name != null) {
    where.like("String_Node_Str",new SelectArg('%' + name + '%'));
    clausesCount++;
  }
  if (rules != null) {
    where.like("String_Node_Str",new SelectArg('%' + rules + '%'));
    clausesCount++;
  }
  if (doubleFaced != null) {
    where.eq("String_Node_Str",doubleFaced);
    clausesCount++;
  }
  for (  Rarity rarity : rarities) {
    where.eq("String_Node_Str",rarity);
  }
  if (!rarities.isEmpty()) {
    where.or(rarities.size());
    clausesCount++;
  }
  for (  String setCode : setCodes) {
    where.eq("String_Node_Str",setCode);
  }
  if (!setCodes.isEmpty()) {
    where.or(setCodes.size());
    clausesCount++;
  }
  if (types.size() != 7) {
    for (    CardType type : types) {
      where.like("String_Node_Str",new SelectArg('%' + type.name() + '%'));
    }
    if (!types.isEmpty()) {
      where.or(types.size());
      clausesCount++;
    }
  }
  for (  CardType type : notTypes) {
    where.not().like("String_Node_Str",new SelectArg('%' + type.name() + '%'));
    clausesCount++;
  }
  for (  String superType : supertypes) {
    where.like("String_Node_Str",new SelectArg('%' + superType + '%'));
    clausesCount++;
  }
  for (  String subType : notSupertypes) {
    where.not().like("String_Node_Str",new SelectArg('%' + subType + '%'));
    clausesCount++;
  }
  for (  String subType : subtypes) {
    where.like("String_Node_Str",new SelectArg('%' + subType + '%'));
    clausesCount++;
  }
  if (convertedManaCost != null) {
    where.eq("String_Node_Str",convertedManaCost);
    clausesCount++;
  }
  if (!black || !blue || !green|| !red|| !white|| !colorless) {
    int colorClauses=0;
    if (black) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (blue) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (green) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (red) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (white) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (colorless) {
      where.eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false);
      where.and(5);
      colorClauses++;
    }
    if (colorClauses > 0) {
      where.or(colorClauses);
      clausesCount++;
    }
  }
  if (minCardNumber != Integer.MIN_VALUE) {
    where.ge("String_Node_Str",minCardNumber);
    clausesCount++;
  }
  if (maxCardNumber != Integer.MAX_VALUE) {
    where.le("String_Node_Str",maxCardNumber);
    clausesCount++;
  }
  if (clausesCount > 0) {
    where.and(clausesCount);
  }
 else {
    where.eq("String_Node_Str",new SelectArg(0));
  }
  if (start != null) {
    qb.offset(start);
  }
  if (count != null) {
    qb.limit(count);
  }
  if (sortBy != null) {
    qb.orderBy(sortBy,true);
  }
}

Fixed version (ground truth):
public void buildQuery(QueryBuilder qb) throws SQLException {
  Where where=qb.where();
  where.eq("String_Node_Str",false);
  where.eq("String_Node_Str",false);
  int clausesCount=2;
  if (name != null) {
    where.like("String_Node_Str",new SelectArg('%' + name + '%'));
    clausesCount++;
  }
  if (nameExact != null) {
    where.like("String_Node_Str",new SelectArg(nameExact));
    clausesCount++;
  }
  if (rules != null) {
    where.like("String_Node_Str",new SelectArg('%' + rules + '%'));
    clausesCount++;
  }
  if (doubleFaced != null) {
    where.eq("String_Node_Str",doubleFaced);
    clausesCount++;
  }
  for (  Rarity rarity : rarities) {
    where.eq("String_Node_Str",rarity);
  }
  if (!rarities.isEmpty()) {
    where.or(rarities.size());
    clausesCount++;
  }
  for (  String setCode : setCodes) {
    where.eq("String_Node_Str",setCode);
  }
  if (!setCodes.isEmpty()) {
    where.or(setCodes.size());
    clausesCount++;
  }
  if (types.size() != 7) {
    for (    CardType type : types) {
      where.like("String_Node_Str",new SelectArg('%' + type.name() + '%'));
    }
    if (!types.isEmpty()) {
      where.or(types.size());
      clausesCount++;
    }
  }
  for (  CardType type : notTypes) {
    where.not().like("String_Node_Str",new SelectArg('%' + type.name() + '%'));
    clausesCount++;
  }
  for (  String superType : supertypes) {
    where.like("String_Node_Str",new SelectArg('%' + superType + '%'));
    clausesCount++;
  }
  for (  String subType : notSupertypes) {
    where.not().like("String_Node_Str",new SelectArg('%' + subType + '%'));
    clausesCount++;
  }
  for (  String subType : subtypes) {
    where.like("String_Node_Str",new SelectArg('%' + subType + '%'));
    clausesCount++;
  }
  if (convertedManaCost != null) {
    where.eq("String_Node_Str",convertedManaCost);
    clausesCount++;
  }
  if (!black || !blue || !green|| !red|| !white|| !colorless) {
    int colorClauses=0;
    if (black) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (blue) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (green) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (red) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (white) {
      where.eq("String_Node_Str",true);
      colorClauses++;
    }
    if (colorless) {
      where.eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false).eq("String_Node_Str",false);
      where.and(5);
      colorClauses++;
    }
    if (colorClauses > 0) {
      where.or(colorClauses);
      clausesCount++;
    }
  }
  if (minCardNumber != Integer.MIN_VALUE) {
    where.ge("String_Node_Str",minCardNumber);
    clausesCount++;
  }
  if (maxCardNumber != Integer.MAX_VALUE) {
    where.le("String_Node_Str",maxCardNumber);
    clausesCount++;
  }
  if (clausesCount > 0) {
    where.and(clausesCount);
  }
 else {
    where.eq("String_Node_Str",new SelectArg(0));
  }
  if (start != null) {
    qb.offset(start);
  }
  if (count != null) {
    qb.limit(count);
  }
  if (sortBy != null) {
    qb.orderBy(sortBy,true);
  }
}