Program: 166949
Project: 166949
Buggy source:
public String toSql(SqlgGraph sqlgGraph,SchemaTableTree schemaTableTree,HasContainer hasContainer){
  String result="String_Node_Str";
  String prefix=sqlgGraph.getSqlDialect().maybeWrapInQoutes(schemaTableTree.getSchemaTable().getSchema());
  prefix+="String_Node_Str";
  prefix+=sqlgGraph.getSqlDialect().maybeWrapInQoutes(schemaTableTree.getSchemaTable().getTable());
  if (p.getBiPredicate() instanceof Compare) {
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      result+=prefix + "String_Node_Str";
    }
 else {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=compareToSql((Compare)p.getBiPredicate());
    return result;
  }
 else   if ((!sqlgGraph.getSqlDialect().supportsBulkWithinOut() || (!SqlgUtil.isBulkWithinAndOut(sqlgGraph,hasContainer))) && p.getBiPredicate() instanceof Contains) {
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      result+=prefix + "String_Node_Str";
    }
 else {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=containsToSql((Contains)p.getBiPredicate(),((Collection<?>)p.getValue()).size());
    return result;
  }
 else   if (sqlgGraph.getSqlDialect().supportsBulkWithinOut() && p.getBiPredicate() instanceof Contains) {
    result+="String_Node_Str" + (schemaTableTree.rootSchemaTableTree().getTmpTableAliasCounter() - 1);
    result+="String_Node_Str";
    return result;
  }
 else   if (p instanceof AndP) {
    AndP<?> andP=(AndP<?>)p;
    Preconditions.checkState(andP.getPredicates().size() == 2,"String_Node_Str");
    P<?> p1=andP.getPredicates().get(0);
    String key;
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      key=result + "String_Node_Str";
    }
 else {
      key=result + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=prefix + key + compareToSql((Compare)p1.getBiPredicate());
    P<?> p2=andP.getPredicates().get(1);
    result+="String_Node_Str" + prefix + key+ compareToSql((Compare)p2.getBiPredicate());
    return result;
  }
 else   if (p instanceof OrP) {
    OrP<?> orP=(OrP<?>)p;
    Preconditions.checkState(orP.getPredicates().size() == 2,"String_Node_Str");
    P<?> p1=orP.getPredicates().get(0);
    String key;
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      key=result + "String_Node_Str";
    }
 else {
      key=result + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=prefix + key + compareToSql((Compare)p1.getBiPredicate());
    P<?> p2=orP.getPredicates().get(1);
    result+="String_Node_Str" + prefix + key+ compareToSql((Compare)p2.getBiPredicate());
    return result;
  }
 else   if (p.getBiPredicate() instanceof Text) {
    prefix+="String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    result+=textToSql(sqlgGraph.getSqlDialect(),prefix,(Text)p.getBiPredicate());
    return result;
  }
 else   if (p.getBiPredicate() instanceof FullText) {
    prefix+="String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    FullText ft=(FullText)p.getBiPredicate();
    result+=sqlgGraph.getSqlDialect().getFullTextQueryText(ft,prefix);
    return result;
  }
  throw new IllegalStateException("String_Node_Str" + p.getBiPredicate().toString());
}

Fixed version (ground truth):
public String toSql(SqlgGraph sqlgGraph,SchemaTableTree schemaTableTree,HasContainer hasContainer){
  String result="String_Node_Str";
  String prefix=sqlgGraph.getSqlDialect().maybeWrapInQoutes(schemaTableTree.getSchemaTable().getSchema());
  prefix+="String_Node_Str";
  prefix+=sqlgGraph.getSqlDialect().maybeWrapInQoutes(schemaTableTree.getSchemaTable().getTable());
  if (p.getBiPredicate() instanceof Compare) {
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str");
    }
 else {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=compareToSql((Compare)p.getBiPredicate());
    return result;
  }
 else   if ((!sqlgGraph.getSqlDialect().supportsBulkWithinOut() || (!SqlgUtil.isBulkWithinAndOut(sqlgGraph,hasContainer))) && p.getBiPredicate() instanceof Contains) {
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str");
    }
 else {
      result+=prefix + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=containsToSql((Contains)p.getBiPredicate(),((Collection<?>)p.getValue()).size());
    return result;
  }
 else   if (sqlgGraph.getSqlDialect().supportsBulkWithinOut() && p.getBiPredicate() instanceof Contains) {
    result+="String_Node_Str" + (schemaTableTree.rootSchemaTableTree().getTmpTableAliasCounter() - 1);
    result+="String_Node_Str";
    return result;
  }
 else   if (p instanceof AndP) {
    AndP<?> andP=(AndP<?>)p;
    Preconditions.checkState(andP.getPredicates().size() == 2,"String_Node_Str");
    P<?> p1=andP.getPredicates().get(0);
    String key;
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      key=result + sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str");
    }
 else {
      key=result + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=prefix + key + compareToSql((Compare)p1.getBiPredicate());
    P<?> p2=andP.getPredicates().get(1);
    result+="String_Node_Str" + prefix + key+ compareToSql((Compare)p2.getBiPredicate());
    return result;
  }
 else   if (p instanceof OrP) {
    OrP<?> orP=(OrP<?>)p;
    Preconditions.checkState(orP.getPredicates().size() == 2,"String_Node_Str");
    P<?> p1=orP.getPredicates().get(0);
    String key;
    if (hasContainer.getKey().equals(T.id.getAccessor())) {
      key=result + sqlgGraph.getSqlDialect().maybeWrapInQoutes("String_Node_Str");
    }
 else {
      key=result + "String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    }
    result+=prefix + key + compareToSql((Compare)p1.getBiPredicate());
    P<?> p2=orP.getPredicates().get(1);
    result+="String_Node_Str" + prefix + key+ compareToSql((Compare)p2.getBiPredicate());
    return result;
  }
 else   if (p.getBiPredicate() instanceof Text) {
    prefix+="String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    result+=textToSql(sqlgGraph.getSqlDialect(),prefix,(Text)p.getBiPredicate());
    return result;
  }
 else   if (p.getBiPredicate() instanceof FullText) {
    prefix+="String_Node_Str" + sqlgGraph.getSqlDialect().maybeWrapInQoutes(hasContainer.getKey());
    FullText ft=(FullText)p.getBiPredicate();
    result+=sqlgGraph.getSqlDialect().getFullTextQueryText(ft,prefix);
    return result;
  }
  throw new IllegalStateException("String_Node_Str" + p.getBiPredicate().toString());
}