Program: 166910
Project: 166910
Buggy source:
private String toOrderByClause(SqlgGraph sqlgGraph,MutableBoolean printedOrderBy,int counter){
  String result="String_Node_Str";
  for (  org.javatuples.Pair<Traversal.Admin<?,?>,Comparator<?>> comparator : this.getDbComparators()) {
    if (!printedOrderBy.booleanValue()) {
      printedOrderBy.setTrue();
      result+="String_Node_Str";
    }
 else {
      result+="String_Node_Str";
    }
    if (comparator.getValue1() instanceof ElementValueComparator) {
      ElementValueComparator elementValueComparator=(ElementValueComparator)comparator.getValue1();
      String prefix=this.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=elementValueComparator.getPropertyKey();
      String alias;
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
 else {
        alias="String_Node_Str" + counter + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
      result+="String_Node_Str" + alias;
      if (elementValueComparator.getValueComparator() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (elementValueComparator.getValueComparator() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + elementValueComparator.getValueComparator().toString());
      }
    }
 else     if (comparator.getValue0() instanceof ElementValueTraversal<?> && comparator.getValue1() instanceof Order) {
      ElementValueTraversal elementValueTraversal=(ElementValueTraversal)comparator.getValue0();
      String prefix=String.valueOf(this.stepDepth);
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.reducedLabels();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=elementValueTraversal.getPropertyKey();
      String alias;
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
        if (alias.equals("String_Node_Str")) {
          throw new IllegalArgumentException("String_Node_Str" + elementValueTraversal.getPropertyKey() + "String_Node_Str");
        }
      }
 else {
        alias="String_Node_Str" + counter + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
      result+="String_Node_Str" + alias;
      if (comparator.getValue1() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (comparator.getValue1() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + comparator.getValue1().toString());
      }
    }
 else {
      Preconditions.checkState(comparator.getValue0().getSteps().size() == 1,"String_Node_Str");
      Preconditions.checkState(comparator.getValue0().getSteps().get(0) instanceof SelectOneStep,"String_Node_Str");
      SelectOneStep selectOneStep=(SelectOneStep)comparator.getValue0().getSteps().get(0);
      Preconditions.checkState(selectOneStep.getScopeKeys().size() == 1,"String_Node_Str");
      Preconditions.checkState(selectOneStep.getLocalChildren().size() == 1,"String_Node_Str");
      Traversal.Admin<?,?> t=(Traversal.Admin<?,?>)selectOneStep.getLocalChildren().get(0);
      Preconditions.checkState(t instanceof ElementValueTraversal || t instanceof TokenTraversal,"String_Node_Str");
      String select=(String)selectOneStep.getScopeKeys().iterator().next();
      SchemaTableTree selectSchemaTableTree=findSelectSchemaTable(select);
      Preconditions.checkState(selectSchemaTableTree != null,"String_Node_Str" + select);
      String prefix;
      if (selectSchemaTableTree.children.isEmpty()) {
        prefix=String.valueOf(selectSchemaTableTree.stepDepth);
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      }
 else {
        prefix=String.valueOf(selectSchemaTableTree.stepDepth);
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
        prefix+=selectSchemaTableTree.labels.iterator().next();
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      }
      prefix+=selectSchemaTableTree.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=selectSchemaTableTree.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      if (t instanceof ElementValueTraversal) {
        ElementValueTraversal elementValueTraversal=(ElementValueTraversal)t;
        prefix+=elementValueTraversal.getPropertyKey();
      }
 else {
        TokenTraversal tokenTraversal=(TokenTraversal)t;
        prefix+=tokenTraversal.getToken().getAccessor();
      }
      String alias;
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
 else {
        alias="String_Node_Str" + selectSchemaTableTree.stepDepth + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
      result+="String_Node_Str" + alias;
      if (comparator.getValue1() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (comparator.getValue1() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + comparator.toString());
      }
    }
  }
  return result;
}

Fixed version (ground truth):
private String toOrderByClause(SqlgGraph sqlgGraph,MutableBoolean printedOrderBy,int counter){
  String result="String_Node_Str";
  for (  org.javatuples.Pair<Traversal.Admin<?,?>,Comparator<?>> comparator : this.getDbComparators()) {
    if (!printedOrderBy.booleanValue()) {
      printedOrderBy.setTrue();
      result+="String_Node_Str";
    }
 else {
      result+="String_Node_Str";
    }
    if (comparator.getValue1() instanceof ElementValueComparator) {
      ElementValueComparator<?> elementValueComparator=(ElementValueComparator<?>)comparator.getValue1();
      String prefix=this.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=elementValueComparator.getPropertyKey();
      String alias;
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
 else {
        alias="String_Node_Str" + counter + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getColumnNameAliasMap().get(prefix));
      }
      result+="String_Node_Str" + alias;
      if (elementValueComparator.getValueComparator() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (elementValueComparator.getValueComparator() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + elementValueComparator.getValueComparator().toString());
      }
    }
 else     if ((comparator.getValue0() instanceof ElementValueTraversal<?> || comparator.getValue0() instanceof TokenTraversal<?,?>) && comparator.getValue1() instanceof Order) {
      Traversal.Admin<?,?> t=(Traversal.Admin<?,?>)comparator.getValue0();
      String prefix=String.valueOf(this.stepDepth);
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.reducedLabels();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=this.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      String key;
      if (t instanceof ElementValueTraversal) {
        ElementValueTraversal<?> elementValueTraversal=(ElementValueTraversal<?>)t;
        key=elementValueTraversal.getPropertyKey();
      }
 else {
        TokenTraversal<?,?> tokenTraversal=(TokenTraversal<?,?>)t;
        if (tokenTraversal.getToken().equals(T.id)) {
          key=Topology.ID;
        }
 else {
          key=tokenTraversal.getToken().getAccessor();
        }
      }
      prefix+=key;
      String alias;
      String rawAlias=this.getColumnNameAliasMap().get(prefix);
      if (rawAlias == null) {
        throw new IllegalArgumentException("String_Node_Str" + prefix + "String_Node_Str");
      }
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(rawAlias);
      }
 else {
        alias="String_Node_Str" + counter + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(rawAlias);
      }
      result+="String_Node_Str" + alias;
      if (comparator.getValue1() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (comparator.getValue1() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + comparator.getValue1().toString());
      }
    }
 else {
      Preconditions.checkState(comparator.getValue0().getSteps().size() == 1,"String_Node_Str");
      Preconditions.checkState(comparator.getValue0().getSteps().get(0) instanceof SelectOneStep,"String_Node_Str");
      SelectOneStep selectOneStep=(SelectOneStep)comparator.getValue0().getSteps().get(0);
      Preconditions.checkState(selectOneStep.getScopeKeys().size() == 1,"String_Node_Str");
      Preconditions.checkState(selectOneStep.getLocalChildren().size() == 1,"String_Node_Str");
      Traversal.Admin<?,?> t=(Traversal.Admin<?,?>)selectOneStep.getLocalChildren().get(0);
      Preconditions.checkState(t instanceof ElementValueTraversal || t instanceof TokenTraversal,"String_Node_Str");
      String select=(String)selectOneStep.getScopeKeys().iterator().next();
      SchemaTableTree selectSchemaTableTree=findSelectSchemaTable(select);
      Preconditions.checkState(selectSchemaTableTree != null,"String_Node_Str" + select);
      String prefix;
      if (selectSchemaTableTree.children.isEmpty()) {
        prefix=String.valueOf(selectSchemaTableTree.stepDepth);
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      }
 else {
        prefix=String.valueOf(selectSchemaTableTree.stepDepth);
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
        prefix+=selectSchemaTableTree.labels.iterator().next();
        prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      }
      prefix+=selectSchemaTableTree.getSchemaTable().getSchema();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      prefix+=selectSchemaTableTree.getSchemaTable().getTable();
      prefix+=SchemaTableTree.ALIAS_SEPARATOR;
      if (t instanceof ElementValueTraversal) {
        ElementValueTraversal<?> elementValueTraversal=(ElementValueTraversal<?>)t;
        prefix+=elementValueTraversal.getPropertyKey();
      }
 else {
        TokenTraversal<?,?> tokenTraversal=(TokenTraversal<?,?>)t;
        if (tokenTraversal.getToken().equals(T.id)) {
          prefix+=Topology.ID;
        }
 else {
          prefix+=tokenTraversal.getToken().getAccessor();
        }
      }
      String alias;
      String rawAlias=this.getColumnNameAliasMap().get(prefix);
      if (rawAlias == null) {
        throw new IllegalArgumentException("String_Node_Str" + prefix + "String_Node_Str");
      }
      if (counter == -1) {
        alias=sqlgGraph.getSqlDialect().maybeWrapInQoutes(rawAlias);
      }
 else {
        alias="String_Node_Str" + selectSchemaTableTree.stepDepth + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(rawAlias);
      }
      result+="String_Node_Str" + alias;
      if (comparator.getValue1() == Order.incr) {
        result+="String_Node_Str";
      }
 else       if (comparator.getValue1() == Order.decr) {
        result+="String_Node_Str";
      }
 else {
        throw new RuntimeException("String_Node_Str" + comparator.toString());
      }
    }
  }
  return result;
}