Program: 167131
Project: 167131
Buggy source:
@Override public void flushRemovedVertices(SqlG sqlG,Map<SchemaTable,List<SqlgVertex>> removeVertexCache){
  if (!removeVertexCache.isEmpty()) {
    for (    Map.Entry<SchemaTable,List<SqlgVertex>> schemaVertices : removeVertexCache.entrySet()) {
      SchemaTable schemaTable=schemaVertices.getKey();
      logger.info("String_Node_Str" + schemaTable.toString());
      dropForeignKeys(sqlG,schemaTable);
      List<SqlgVertex> vertices=schemaVertices.getValue();
      int numberOfLoops=(vertices.size() / PARAMETER_LIMIT);
      int previous=0;
      for (int i=1; i <= numberOfLoops + 1; i++) {
        int sublistTo=i * PARAMETER_LIMIT;
        List<SqlgVertex> subVertices;
        if (i <= numberOfLoops) {
          subVertices=vertices.subList(previous,sublistTo);
        }
 else {
          subVertices=vertices.subList(previous,vertices.size());
        }
        previous=sublistTo;
        if (!subVertices.isEmpty()) {
          Pair<Set<Long>,Set<SchemaTable>> outLabels=Pair.of(new HashSet<Long>(),new HashSet<SchemaTable>());
          Pair<Set<Long>,Set<SchemaTable>> inLabels=Pair.of(new HashSet<Long>(),new HashSet<SchemaTable>());
          getInAndOutEdgesToRemove(sqlG,subVertices,outLabels,inLabels);
          deleteEdges(sqlG,schemaTable,outLabels,true);
          deleteEdges(sqlG,schemaTable,inLabels,false);
          StringBuilder sql=new StringBuilder("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes((SchemaManager.VERTEX_PREFIX) + schemaTable.getTable()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
          sql.append("String_Node_Str");
          int count=1;
          for (          SqlgVertex sqlgVertex : subVertices) {
            sql.append("String_Node_Str");
            if (count++ < subVertices.size()) {
              sql.append("String_Node_Str");
            }
          }
          sql.append("String_Node_Str");
          if (sqlG.getSqlDialect().needsSemicolon()) {
            sql.append("String_Node_Str");
          }
          if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
          }
          Connection conn=sqlG.tx().getConnection();
          try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
            count=1;
            for (            SqlgVertex sqlgVertex : subVertices) {
              preparedStatement.setLong(count++,(Long)sqlgVertex.id());
            }
            preparedStatement.executeUpdate();
          }
 catch (          SQLException e) {
            throw new RuntimeException(e);
          }
          sql=new StringBuilder("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes(sqlG.getSqlDialect().getPublicSchema()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTICES));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
          sql.append("String_Node_Str");
          count=1;
          for (          SqlgVertex vertex : subVertices) {
            sql.append("String_Node_Str");
            if (count++ < subVertices.size()) {
              sql.append("String_Node_Str");
            }
          }
          sql.append("String_Node_Str");
          if (sqlG.getSqlDialect().needsSemicolon()) {
            sql.append("String_Node_Str");
          }
          if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
          }
          conn=sqlG.tx().getConnection();
          try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
            count=1;
            for (            SqlgVertex vertex : subVertices) {
              preparedStatement.setLong(count++,(Long)vertex.id());
            }
            preparedStatement.executeUpdate();
          }
 catch (          SQLException e) {
            throw new RuntimeException(e);
          }
        }
      }
      createForeignKeys(sqlG,schemaTable);
    }
  }
}

Fixed version (ground truth):
@Override public void flushRemovedVertices(SqlG sqlG,Map<SchemaTable,List<SqlgVertex>> removeVertexCache){
  if (!removeVertexCache.isEmpty()) {
    for (    Map.Entry<SchemaTable,List<SqlgVertex>> schemaVertices : removeVertexCache.entrySet()) {
      SchemaTable schemaTable=schemaVertices.getKey();
      dropForeignKeys(sqlG,schemaTable);
      List<SqlgVertex> vertices=schemaVertices.getValue();
      int numberOfLoops=(vertices.size() / PARAMETER_LIMIT);
      int previous=0;
      for (int i=1; i <= numberOfLoops + 1; i++) {
        int sublistTo=i * PARAMETER_LIMIT;
        List<SqlgVertex> subVertices;
        if (i <= numberOfLoops) {
          subVertices=vertices.subList(previous,sublistTo);
        }
 else {
          subVertices=vertices.subList(previous,vertices.size());
        }
        previous=sublistTo;
        if (!subVertices.isEmpty()) {
          Pair<Set<Long>,Set<SchemaTable>> outLabels=Pair.of(new HashSet<Long>(),new HashSet<SchemaTable>());
          Pair<Set<Long>,Set<SchemaTable>> inLabels=Pair.of(new HashSet<Long>(),new HashSet<SchemaTable>());
          getInAndOutEdgesToRemove(sqlG,subVertices,outLabels,inLabels);
          deleteEdges(sqlG,schemaTable,outLabels,true);
          deleteEdges(sqlG,schemaTable,inLabels,false);
          StringBuilder sql=new StringBuilder("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes(schemaTable.getSchema()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes((SchemaManager.VERTEX_PREFIX) + schemaTable.getTable()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSchemaManager().getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
          sql.append("String_Node_Str");
          int count=1;
          for (          SqlgVertex sqlgVertex : subVertices) {
            sql.append("String_Node_Str");
            if (count++ < subVertices.size()) {
              sql.append("String_Node_Str");
            }
          }
          sql.append("String_Node_Str");
          if (sqlG.getSqlDialect().needsSemicolon()) {
            sql.append("String_Node_Str");
          }
          if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
          }
          Connection conn=sqlG.tx().getConnection();
          try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
            count=1;
            for (            SqlgVertex sqlgVertex : subVertices) {
              preparedStatement.setLong(count++,(Long)sqlgVertex.id());
            }
            preparedStatement.executeUpdate();
          }
 catch (          SQLException e) {
            throw new RuntimeException(e);
          }
          sql=new StringBuilder("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes(sqlG.getSqlDialect().getPublicSchema()));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes(SchemaManager.VERTICES));
          sql.append("String_Node_Str");
          sql.append(sqlG.getSqlDialect().maybeWrapInQoutes("String_Node_Str"));
          sql.append("String_Node_Str");
          count=1;
          for (          SqlgVertex vertex : subVertices) {
            sql.append("String_Node_Str");
            if (count++ < subVertices.size()) {
              sql.append("String_Node_Str");
            }
          }
          sql.append("String_Node_Str");
          if (sqlG.getSqlDialect().needsSemicolon()) {
            sql.append("String_Node_Str");
          }
          if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
          }
          conn=sqlG.tx().getConnection();
          try (PreparedStatement preparedStatement=conn.prepareStatement(sql.toString())){
            count=1;
            for (            SqlgVertex vertex : subVertices) {
              preparedStatement.setLong(count++,(Long)vertex.id());
            }
            preparedStatement.executeUpdate();
          }
 catch (          SQLException e) {
            throw new RuntimeException(e);
          }
        }
      }
      createForeignKeys(sqlG,schemaTable);
    }
  }
}