Program: 167024
Project: 167024
Buggy source:
public void removeVertex(String schema,String table,SqlgVertex vertex){
  SchemaTable schemaTable=SchemaTable.of(schema,table);
  Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> vertexSortedSetMapPair=this.vertexCache.get(schemaTable);
  if (vertexSortedSetMapPair != null && vertexSortedSetMapPair.getRight().containsKey(vertex)) {
    vertexSortedSetMapPair.getRight().remove(vertex);
    Map<SchemaTable,List<SqlgEdge>> outEdges=this.vertexOutEdgeCache.get(vertex);
    if (outEdges != null) {
      for (      Map.Entry<SchemaTable,List<SqlgEdge>> entry : outEdges.entrySet()) {
        SchemaTable edgeSchemaTable=entry.getKey();
        List<SqlgEdge> edges=entry.getValue();
        Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> cachedEdge=this.edgeCache.get(edgeSchemaTable);
        if (cachedEdge == null) {
          throw new IllegalStateException("String_Node_Str");
        }
        for (        SqlgEdge sqlgEdge : edges) {
          cachedEdge.getRight().remove(sqlgEdge);
        }
        if (cachedEdge.getRight().isEmpty()) {
          this.edgeCache.remove(edgeSchemaTable);
        }
      }
      this.vertexOutEdgeCache.remove(vertex);
    }
    Map<SchemaTable,List<SqlgEdge>> inEdges=this.vertexInEdgeCache.get(vertex);
    if (inEdges != null) {
      for (      Map.Entry<SchemaTable,List<SqlgEdge>> entry : inEdges.entrySet()) {
        SchemaTable edgeSchemaTable=entry.getKey();
        List<SqlgEdge> edges=entry.getValue();
        Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> cachedEdge=this.edgeCache.get(edgeSchemaTable);
        if (cachedEdge == null) {
          throw new IllegalStateException("String_Node_Str");
        }
        for (        SqlgEdge sqlgEdge : edges) {
          cachedEdge.getRight().remove(sqlgEdge);
        }
        if (cachedEdge.getRight().isEmpty()) {
          this.edgeCache.remove(edgeSchemaTable);
        }
      }
      this.vertexInEdgeCache.remove(vertex);
    }
  }
 else {
    List<SqlgVertex> vertices=this.removeVertexCache.get(schemaTable);
    if (vertices == null) {
      vertices=new ArrayList<>();
      this.removeVertexCache.put(schemaTable,vertices);
    }
    vertices.add(vertex);
  }
}

Fixed version (ground truth):
void removeVertex(String schema,String table,SqlgVertex vertex){
  SchemaTable schemaTable=SchemaTable.of(schema,table);
  Pair<SortedSet<String>,Map<SqlgVertex,Map<String,Object>>> vertexSortedSetMapPair=this.vertexCache.get(schemaTable);
  if (vertexSortedSetMapPair != null && vertexSortedSetMapPair.getRight().containsKey(vertex)) {
    vertexSortedSetMapPair.getRight().remove(vertex);
    Set<MetaEdge> toRemoveMetaEdges=new HashSet<>();
    for (    Map.Entry<MetaEdge,Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>>> metaEdgePairEntry : this.edgeCache.entrySet()) {
      MetaEdge metaEdge=metaEdgePairEntry.getKey();
      Pair<SortedSet<String>,Map<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>>> edges=metaEdgePairEntry.getValue();
      Set<SqlgEdge> toRemove=new HashSet<>();
      for (      Map.Entry<SqlgEdge,Triple<SqlgVertex,SqlgVertex,Map<String,Object>>> sqlgEdgeTripleEntry : edges.getRight().entrySet()) {
        SqlgEdge sqlgEdge=sqlgEdgeTripleEntry.getKey();
        Triple<SqlgVertex,SqlgVertex,Map<String,Object>> inOutVertices=sqlgEdgeTripleEntry.getValue();
        if (inOutVertices.getLeft().equals(vertex) || inOutVertices.getMiddle().equals(vertex)) {
          toRemove.add(sqlgEdge);
        }
      }
      for (      SqlgEdge sqlgEdge : toRemove) {
        edges.getRight().remove(sqlgEdge);
      }
      if (edges.getRight().isEmpty()) {
        toRemoveMetaEdges.add(metaEdge);
      }
    }
    for (    MetaEdge toRemoveMetaEdge : toRemoveMetaEdges) {
      this.edgeCache.remove(toRemoveMetaEdge);
    }
  }
 else {
    List<SqlgVertex> vertices=this.removeVertexCache.get(schemaTable);
    if (vertices == null) {
      vertices=new ArrayList<>();
      this.removeVertexCache.put(schemaTable,vertices);
    }
    vertices.add(vertex);
  }
}