Program: 167076
Project: 167076
Buggy source:
void addEdge(boolean complete,SqlgEdge sqlgEdge,SqlgVertex outVertex,SqlgVertex inVertex,Map<String,Object> keyValueMap){
  SchemaTable outSchemaTable=SchemaTable.of(outVertex.getSchema(),sqlgEdge.getTable());
  if (!complete) {
    Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>> triples=this.edgeCache.get(outSchemaTable);
    if (triples == null) {
      triples=new LinkedHashMap<>();
      triples.put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
      this.edgeCache.put(outSchemaTable,triples);
    }
 else {
      triples.put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
    }
    Map<SchemaTable,List<SqlgEdge>> outEdgesMap=this.vertexOutEdgeCache.get(outVertex);
    if (outEdgesMap == null) {
      outEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexOutEdgeCache.put(outVertex,outEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=outEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
    Map<SchemaTable,List<SqlgEdge>> inEdgesMap=this.vertexInEdgeCache.get(outVertex);
    if (inEdgesMap == null) {
      inEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexInEdgeCache.put(inVertex,inEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=inEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
  }
 else {
    if (this.streamingBatchModeEdgeSchemaTable == null) {
      this.streamingBatchModeEdgeSchemaTable=sqlgEdge.getSchemaTablePrefixed();
    }
    if (this.streamingBatchModeEdgeKeys == null) {
      this.streamingBatchModeEdgeKeys=new ArrayList<>(keyValueMap.keySet());
    }
    if (isStreamingVertices()) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (isBatchModeBatchStreaming() && this.batchCount == this.batchSize) {
      throw new IllegalStateException("String_Node_Str" + this.batchCount + "String_Node_Str"+ this.batchSize);
    }
    if (isBatchModeBatchStreaming() && this.batchCount == 0) {
      this.batchedElements=new ArrayList<>();
      this.sqlDialect.lockTable(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.sequenceName=this.sqlDialect.sequenceName(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.batchIndex=this.sqlDialect.nextSequenceVal(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
    }
    if (isBatchModeBatchStreaming() && this.batchCount > 0) {
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
      this.batchedElements.add(sqlgEdge);
    }
    OutputStream out=this.streamingEdgeCache.get(outSchemaTable);
    if (out == null) {
      String sql=this.sqlDialect.constructCompleteCopyCommandSqlEdge(sqlgGraph,sqlgEdge,outVertex,inVertex,keyValueMap);
      out=this.sqlDialect.streamSql(this.sqlgGraph,sql);
      this.streamingEdgeCache.put(outSchemaTable,out);
    }
    try {
      this.sqlDialect.flushCompleteEdge(out,sqlgEdge,outVertex,inVertex,keyValueMap);
      if (isBatchModeBatchStreaming()) {
        this.batchCount++;
      }
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    if (isBatchModeBatchStreaming() && this.batchCount == this.batchSize) {
      this.flush();
      if (this.batchCallback != null) {
        this.batchCallback.callBack(this.batchedElements);
        this.batchedElements.clear();
      }
    }
  }
}

Fixed version (ground truth):
void addEdge(boolean streaming,SqlgEdge sqlgEdge,SqlgVertex outVertex,SqlgVertex inVertex,Map<String,Object> keyValueMap){
  SchemaTable outSchemaTable=SchemaTable.of(outVertex.getSchema(),sqlgEdge.getTable());
  if (!streaming) {
    Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> triples=this.edgeCache.get(outSchemaTable);
    if (triples == null) {
      triples=Pair.of(new TreeSet<>(keyValueMap.keySet()),new LinkedHashMap<>());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
      this.edgeCache.put(outSchemaTable,triples);
    }
 else {
      triples.getLeft().addAll(keyValueMap.keySet());
      triples.getRight().put(sqlgEdge,Triple.of(outVertex,inVertex,keyValueMap));
    }
    Map<SchemaTable,List<SqlgEdge>> outEdgesMap=this.vertexOutEdgeCache.get(outVertex);
    if (outEdgesMap == null) {
      outEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexOutEdgeCache.put(outVertex,outEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=outEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        outEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
    Map<SchemaTable,List<SqlgEdge>> inEdgesMap=this.vertexInEdgeCache.get(outVertex);
    if (inEdgesMap == null) {
      inEdgesMap=new HashMap<>();
      List<SqlgEdge> edges=new ArrayList<>();
      edges.add(sqlgEdge);
      inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      this.vertexInEdgeCache.put(inVertex,inEdgesMap);
    }
 else {
      List<SqlgEdge> sqlgEdges=inEdgesMap.get(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()));
      if (sqlgEdges == null) {
        List<SqlgEdge> edges=new ArrayList<>();
        edges.add(sqlgEdge);
        inEdgesMap.put(SchemaTable.of(sqlgEdge.getSchema(),sqlgEdge.getTable()),edges);
      }
 else {
        sqlgEdges.add(sqlgEdge);
      }
    }
  }
 else {
    if (this.streamingBatchModeEdgeSchemaTable == null) {
      this.streamingBatchModeEdgeSchemaTable=sqlgEdge.getSchemaTablePrefixed();
    }
    if (this.streamingBatchModeEdgeKeys == null) {
      this.streamingBatchModeEdgeKeys=new ArrayList<>(keyValueMap.keySet());
    }
    if (isStreamingVertices()) {
      throw new IllegalStateException("String_Node_Str");
    }
    if (isBatchModeBatchStreaming() && this.batchCount == this.batchSize) {
      throw new IllegalStateException("String_Node_Str" + this.batchCount + "String_Node_Str"+ this.batchSize);
    }
    if (isBatchModeBatchStreaming() && this.batchCount == 0) {
      this.batchedElements=new ArrayList<>();
      this.sqlDialect.lockTable(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.sequenceName=this.sqlDialect.sequenceName(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      this.batchIndex=this.sqlDialect.nextSequenceVal(sqlgGraph,outSchemaTable,SchemaManager.EDGE_PREFIX);
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
    }
    if (isBatchModeBatchStreaming() && this.batchCount > 0) {
      sqlgEdge.setInternalPrimaryKey(RecordId.from(outSchemaTable,++this.batchIndex));
      this.batchedElements.add(sqlgEdge);
    }
    OutputStream out=this.streamingEdgeCache.get(outSchemaTable);
    if (out == null) {
      String sql=this.sqlDialect.constructCompleteCopyCommandSqlEdge(sqlgGraph,sqlgEdge,outVertex,inVertex,keyValueMap);
      out=this.sqlDialect.streamSql(this.sqlgGraph,sql);
      this.streamingEdgeCache.put(outSchemaTable,out);
    }
    try {
      this.sqlDialect.flushCompleteEdge(out,sqlgEdge,outVertex,inVertex,keyValueMap);
      if (isBatchModeBatchStreaming()) {
        this.batchCount++;
      }
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    if (isBatchModeBatchStreaming() && this.batchCount == this.batchSize) {
      this.flush();
      if (this.batchCallback != null) {
        this.batchCallback.callBack(this.batchedElements);
        this.batchedElements.clear();
      }
    }
  }
}