Program: 59601
Project: 59601
Buggy source:
public static BoolCommonExpression parse(String primaryKeyName,List<OrderByExpression> orderByList,String skipToken){
  if (skipToken == null)   return null;
  List<BoolCommonExpression> predicates=new ArrayList<BoolCommonExpression>();
  List<LiteralExpression> orderByValues=new ArrayList<LiteralExpression>();
  int start=0;
  int end=0;
  if (orderByList != null) {
    for (int i=0; i < orderByList.size(); i++) {
      OrderByExpression orderBy=orderByList.get(i);
      end=skipToken.indexOf(',',start);
      String orderByValueString=skipToken.substring(start,end);
      LiteralExpression orderByValue=(LiteralExpression)Expression.parse(orderByValueString);
      orderByValues.add(orderByValue);
      BoolCommonExpression ordExp=orderBy.getDirection() == Direction.ASCENDING ? Expression.gt(orderBy.getExpression(),orderByValue) : Expression.lt(orderBy.getExpression(),orderByValue);
      predicates.add(ordExp);
      start=end + 1;
    }
  }
  OEntityKey entityKey=OEntityKey.parse(skipToken.substring(start));
  if (entityKey.getKeyType() == KeyType.SINGLE) {
    LiteralExpression entityKeyValue=Expression.literal(entityKey.asSingleValue());
    BoolCommonExpression keyPredicate=Expression.gt(Expression.simpleProperty(primaryKeyName),entityKeyValue);
    predicates.add(keyPredicate);
  }
 else {
    List<OProperty<?>> keyProperties=new ArrayList<OProperty<?>>(entityKey.asComplexProperties());
    BoolCommonExpression keyPredicate=null;
    for (int i=0; i < keyProperties.size(); i++) {
      OProperty<?> keyProperty=keyProperties.get(i);
      BoolCommonExpression subPredicate=Expression.gt(Expression.simpleProperty(primaryKeyName + "String_Node_Str" + keyProperty.getName()),Expression.literal(keyProperty.getValue()));
      for (int j=0; j < i; j++) {
        OProperty<?> earlierKeyProperty=keyProperties.get(j);
        BoolCommonExpression eq=Expression.eq(Expression.simpleProperty(primaryKeyName + "String_Node_Str" + earlierKeyProperty.getName()),Expression.literal(earlierKeyProperty.getValue()));
        subPredicate=Expression.and(eq,subPredicate);
      }
      if (keyPredicate == null)       keyPredicate=subPredicate;
 else       keyPredicate=Expression.or(keyPredicate,subPredicate);
    }
    predicates.add(keyPredicate);
  }
  for (int i=1; i < predicates.size(); i++) {
    BoolCommonExpression predicate=predicates.get(i);
    for (int j=0; j < i; j++) {
      OrderByExpression orderBy=orderByList.get(j);
      BoolCommonExpression eq=Expression.eq(orderBy.getExpression(),orderByValues.get(j));
      predicate=Expression.and(eq,predicate);
    }
    predicates.set(i,predicate);
  }
  BoolCommonExpression rt=predicates.get(0);
  for (int i=1; i < predicates.size(); i++)   rt=Expression.or(rt,predicates.get(i));
  return rt;
}

Fixed version (ground truth):
public static BoolCommonExpression parse(String primaryKeyName,List<OrderByExpression> orderByList,String skipToken){
  if (skipToken == null)   return null;
  List<BoolCommonExpression> predicates=new ArrayList<BoolCommonExpression>();
  List<LiteralExpression> orderByValues=new ArrayList<LiteralExpression>();
  int start=0;
  int end=0;
  if (orderByList != null) {
    for (int i=0; i < orderByList.size(); i++) {
      OrderByExpression orderBy=orderByList.get(i);
      end=skipToken.indexOf(',',start);
      String orderByValueString=skipToken.substring(start,end);
      LiteralExpression orderByValue=(LiteralExpression)Expression.parse(orderByValueString);
      orderByValues.add(orderByValue);
      BoolCommonExpression ordExp=orderBy.getDirection() == Direction.ASCENDING ? Expression.gt(orderBy.getExpression(),orderByValue) : Expression.lt(orderBy.getExpression(),orderByValue);
      predicates.add(ordExp);
      start=end + 1;
    }
  }
  OEntityKey entityKey=OEntityKey.parse(skipToken.substring(start));
  if (entityKey.getKeyType() == KeyType.SINGLE) {
    LiteralExpression entityKeyValue=Expression.literal(entityKey.asSingleValue());
    BoolCommonExpression keyPredicate=Expression.gt(Expression.simpleProperty(primaryKeyName),entityKeyValue);
    predicates.add(keyPredicate);
  }
 else {
    List<OProperty<?>> keyProperties=new ArrayList<OProperty<?>>(entityKey.asComplexProperties());
    BoolCommonExpression keyPredicate=null;
    for (int i=0; i < keyProperties.size(); i++) {
      OProperty<?> keyProperty=keyProperties.get(i);
      BoolCommonExpression subPredicate=Expression.gt(Expression.simpleProperty(primaryKeyName + "String_Node_Str" + keyProperty.getName()),Expression.literal(keyProperty.getValue()));
      for (int j=0; j < i; j++) {
        OProperty<?> earlierKeyProperty=keyProperties.get(j);
        BoolCommonExpression eq=Expression.eq(Expression.simpleProperty(primaryKeyName + "String_Node_Str" + earlierKeyProperty.getName()),Expression.literal(earlierKeyProperty.getValue()));
        subPredicate=Expression.and(eq,subPredicate);
      }
      if (keyPredicate == null)       keyPredicate=subPredicate;
 else       keyPredicate=Expression.or(keyPredicate,subPredicate);
    }
    predicates.add(keyPredicate);
  }
  for (int i=1; i < predicates.size(); i++) {
    BoolCommonExpression predicate=predicates.get(i);
    for (int j=0; j < i; j++) {
      OrderByExpression orderBy=orderByList.get(j);
      BoolCommonExpression eq=Expression.eq(orderBy.getExpression(),orderByValues.get(j));
      predicate=Expression.and(eq,predicate);
    }
    predicates.set(i,Expression.boolParen(predicate));
  }
  BoolCommonExpression rt=predicates.get(0);
  for (int i=1; i < predicates.size(); i++)   rt=Expression.or(rt,predicates.get(i));
  return Expression.boolParen(rt);
}