Program: 166961
Project: 166961
Buggy source:
public static void addIndex(SqlgGraph sqlgGraph,AbstractLabel abstractLabel,Index index,IndexType indexType,List<PropertyColumn> properties){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    GraphTraversalSource traversalSource=sqlgGraph.topology();
    List<Vertex> abstractLabelVertexes;
    if (abstractLabel instanceof VertexLabel) {
      abstractLabelVertexes=traversalSource.V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_SCHEMA).has(SQLG_SCHEMA_SCHEMA_NAME,abstractLabel.getSchema().getName()).out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",abstractLabel.getLabel()).toList();
    }
 else {
      abstractLabelVertexes=traversalSource.V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_SCHEMA).has(SQLG_SCHEMA_SCHEMA_NAME,abstractLabel.getSchema().getName()).out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).out(SQLG_SCHEMA_OUT_EDGES_EDGE).has("String_Node_Str",abstractLabel.getLabel()).toList();
    }
    Preconditions.checkState(!abstractLabelVertexes.isEmpty(),"String_Node_Str",abstractLabel.getSchema().getName(),abstractLabel.getLabel());
    Preconditions.checkState(abstractLabelVertexes.size() == 1,"String_Node_Str",abstractLabel.getSchema().getName(),abstractLabel.getLabel());
    Vertex abstractLabelVertex=abstractLabelVertexes.get(0);
    Vertex indexVertex=sqlgGraph.addVertex(T.label,SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_INDEX,SQLG_SCHEMA_INDEX_NAME,index.getName(),SQLG_SCHEMA_INDEX_INDEX_TYPE,indexType.toString(),CREATED_ON,LocalDateTime.now());
    if (abstractLabel instanceof VertexLabel) {
      abstractLabelVertex.addEdge(SQLG_SCHEMA_VERTEX_INDEX_EDGE,indexVertex);
    }
 else {
      abstractLabelVertex.addEdge(SQLG_SCHEMA_EDGE_INDEX_EDGE,indexVertex);
    }
    for (    PropertyColumn property : properties) {
      List<Vertex> propertyVertexes=traversalSource.V(abstractLabelVertex).out(abstractLabel instanceof VertexLabel ? SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE : SQLG_SCHEMA_EDGE_PROPERTIES_EDGE).has("String_Node_Str",property.getName()).toList();
      Preconditions.checkState(!propertyVertexes.isEmpty(),"String_Node_Str",property.getName(),abstractLabel.getSchema().getName(),abstractLabel.getLabel());
      Preconditions.checkState(propertyVertexes.size() == 1,"String_Node_Str",property.getName(),abstractLabel.getSchema().getName(),abstractLabel.getLabel());
      Vertex propertyVertex=propertyVertexes.get(0);
      indexVertex.addEdge(SQLG_SCHEMA_INDEX_PROPERTY_EDGE,propertyVertex);
    }
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}

Fixed version (ground truth):
/** 
 * add an index from information schema
 * @param sqlgGraph the graph
 * @param schema the schema name
 * @param label the label name
 * @param vertex is it a vertex or an edge label?
 * @param index the index name
 * @param indexType index type
 * @param properties the column names
 */
public static void addIndex(SqlgGraph sqlgGraph,String schema,String label,boolean vertex,String index,IndexType indexType,List<String> properties){
  BatchManager.BatchModeType batchModeType=flushAndSetTxToNone(sqlgGraph);
  try {
    GraphTraversalSource traversalSource=sqlgGraph.topology();
    List<Vertex> abstractLabelVertexes;
    if (vertex) {
      abstractLabelVertexes=traversalSource.V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_SCHEMA).has(SQLG_SCHEMA_SCHEMA_NAME,schema).out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).has("String_Node_Str",label).toList();
    }
 else {
      abstractLabelVertexes=traversalSource.V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_SCHEMA).has(SQLG_SCHEMA_SCHEMA_NAME,schema).out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).out(SQLG_SCHEMA_OUT_EDGES_EDGE).has("String_Node_Str",label).toList();
    }
    Preconditions.checkState(!abstractLabelVertexes.isEmpty(),"String_Node_Str",schema,label);
    Preconditions.checkState(abstractLabelVertexes.size() == 1,"String_Node_Str",schema,label);
    Vertex abstractLabelVertex=abstractLabelVertexes.get(0);
    Vertex indexVertex=sqlgGraph.addVertex(T.label,SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_INDEX,SQLG_SCHEMA_INDEX_NAME,index,SQLG_SCHEMA_INDEX_INDEX_TYPE,indexType.toString(),CREATED_ON,LocalDateTime.now());
    if (vertex) {
      abstractLabelVertex.addEdge(SQLG_SCHEMA_VERTEX_INDEX_EDGE,indexVertex);
    }
 else {
      abstractLabelVertex.addEdge(SQLG_SCHEMA_EDGE_INDEX_EDGE,indexVertex);
    }
    for (    String property : properties) {
      List<Vertex> propertyVertexes=traversalSource.V(abstractLabelVertex).out(vertex ? SQLG_SCHEMA_VERTEX_PROPERTIES_EDGE : SQLG_SCHEMA_EDGE_PROPERTIES_EDGE).has("String_Node_Str",property).toList();
      Preconditions.checkState(!propertyVertexes.isEmpty(),"String_Node_Str",property,schema,label);
      Preconditions.checkState(propertyVertexes.size() == 1,"String_Node_Str",property,schema,label);
      Vertex propertyVertex=propertyVertexes.get(0);
      indexVertex.addEdge(SQLG_SCHEMA_INDEX_PROPERTY_EDGE,propertyVertex);
    }
  }
  finally {
    sqlgGraph.tx().batchMode(batchModeType);
  }
}