Program: 166953
Project: 166953
Buggy source:
private static String constructSectionedJoin(SchemaTableTree fromSchemaTableTree,SchemaTableTree toSchemaTableTree,int count){
  if (toSchemaTableTree.direction == Direction.BOTH) {
    throw new IllegalStateException("String_Node_Str");
  }
  String rawToLabel;
  if (toSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
    rawToLabel=toSchemaTableTree.getSchemaTable().getTable().substring(SchemaManager.VERTEX_PREFIX.length());
  }
 else {
    rawToLabel=toSchemaTableTree.getSchemaTable().getTable();
  }
  String rawFromLabel;
  if (fromSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
    rawFromLabel=fromSchemaTableTree.getSchemaTable().getTable().substring(SchemaManager.VERTEX_PREFIX.length());
  }
 else {
    rawFromLabel=fromSchemaTableTree.getSchemaTable().getTable();
  }
  String result;
  if (fromSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.EDGE_PREFIX)) {
    if (toSchemaTableTree.isEdgeVertexStep()) {
      if (toSchemaTableTree.direction == Direction.OUT) {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.OUT_VERTEX_COLUMN_END+ "String_Node_Str";
        result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.lastMappedAliasId()+ "String_Node_Str";
      }
 else {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.IN_VERTEX_COLUMN_END+ "String_Node_Str";
        result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.lastMappedAliasId()+ "String_Node_Str";
      }
    }
 else {
      if (toSchemaTableTree.direction == Direction.OUT) {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.IN_VERTEX_COLUMN_END+ "String_Node_Str";
        result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.lastMappedAliasId()+ "String_Node_Str";
      }
 else {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.OUT_VERTEX_COLUMN_END+ "String_Node_Str";
        result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.lastMappedAliasId()+ "String_Node_Str";
      }
    }
  }
 else {
    if (toSchemaTableTree.direction == Direction.OUT) {
      result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ SchemaManager.ID+ "String_Node_Str";
      result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.mappedAliasVertexForeignKeyColumnEnd(fromSchemaTableTree,toSchemaTableTree.direction,rawFromLabel)+ "String_Node_Str";
    }
 else {
      result="String_Node_Str" + (count - 1) + "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ SchemaManager.ID+ "String_Node_Str";
      result+="String_Node_Str" + count + "String_Node_Str"+ toSchemaTableTree.mappedAliasVertexForeignKeyColumnEnd(fromSchemaTableTree,toSchemaTableTree.direction,rawFromLabel)+ "String_Node_Str";
    }
  }
  return result;
}

Fixed version (ground truth):
private static String constructSectionedJoin(SqlgGraph sqlgGraph,SchemaTableTree fromSchemaTableTree,SchemaTableTree toSchemaTableTree,int count){
  if (toSchemaTableTree.direction == Direction.BOTH) {
    throw new IllegalStateException("String_Node_Str");
  }
  String rawToLabel;
  if (toSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
    rawToLabel=toSchemaTableTree.getSchemaTable().getTable().substring(SchemaManager.VERTEX_PREFIX.length());
  }
 else {
    rawToLabel=toSchemaTableTree.getSchemaTable().getTable();
  }
  String rawFromLabel;
  if (fromSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.VERTEX_PREFIX)) {
    rawFromLabel=fromSchemaTableTree.getSchemaTable().getTable().substring(SchemaManager.VERTEX_PREFIX.length());
  }
 else {
    rawFromLabel=fromSchemaTableTree.getSchemaTable().getTable();
  }
  String result;
  if (fromSchemaTableTree.getSchemaTable().getTable().startsWith(SchemaManager.EDGE_PREFIX)) {
    if (toSchemaTableTree.isEdgeVertexStep()) {
      if (toSchemaTableTree.direction == Direction.OUT) {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.OUT_VERTEX_COLUMN_END);
        result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.lastMappedAliasId());
      }
 else {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.IN_VERTEX_COLUMN_END);
        result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.lastMappedAliasId());
      }
    }
 else {
      if (toSchemaTableTree.direction == Direction.OUT) {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.IN_VERTEX_COLUMN_END);
        result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.lastMappedAliasId());
      }
 else {
        result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ toSchemaTableTree.getSchemaTable().getSchema()+ "String_Node_Str"+ rawToLabel+ SchemaManager.OUT_VERTEX_COLUMN_END);
        result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.lastMappedAliasId());
      }
    }
  }
 else {
    if (toSchemaTableTree.direction == Direction.OUT) {
      result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ SchemaManager.ID);
      result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.mappedAliasVertexForeignKeyColumnEnd(fromSchemaTableTree,toSchemaTableTree.direction,rawFromLabel));
    }
 else {
      result="String_Node_Str" + (count - 1) + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(fromSchemaTableTree.getSchemaTable().getSchema() + "String_Node_Str" + fromSchemaTableTree.getSchemaTable().getTable()+ "String_Node_Str"+ SchemaManager.ID);
      result+="String_Node_Str" + count + "String_Node_Str"+ sqlgGraph.getSqlDialect().maybeWrapInQoutes(toSchemaTableTree.mappedAliasVertexForeignKeyColumnEnd(fromSchemaTableTree,toSchemaTableTree.direction,rawFromLabel));
    }
  }
  return result;
}