Program: 167058
Project: 167058
Buggy source:
SchemaManager(SqlgGraph sqlgGraph,SqlDialect sqlDialect,Configuration configuration){
  this.sqlgGraph=sqlgGraph;
  this.sqlDialect=sqlDialect;
  this.distributed=configuration.getBoolean("String_Node_Str",false);
  if (this.distributed) {
    this.hazelcastInstance=Hazelcast.newHazelcastInstance(configHazelcast(configuration));
    this.schemas=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + SCHEMAS_HAZELCAST_MAP);
    this.labelSchemas=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + LABEL_SCHEMAS_HAZELCAST_MAP);
    this.tables=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + TABLES_HAZELCAST_MAP);
    this.edgeForeignKeys=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + EDGE_FOREIGN_KEYS_HAZELCAST_MAP);
    this.tableLabels=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + TABLE_LABELS_HAZELCAST_MAP);
    ((IMap)this.schemas).addEntryListener(new SchemasMapEntryListener(),true);
    ((IMap)this.labelSchemas).addEntryListener(new LabelSchemasMapEntryListener(),true);
    ((IMap)this.tables).addEntryListener(new TablesMapEntryListener(),true);
    ((IMap)this.edgeForeignKeys).addEntryListener(new EdgeForeignKeysMapEntryListener(),true);
    ((IMap)this.tableLabels).addEntryListener(new TableLabelMapEntryListener(),true);
    this.schemaLock=this.hazelcastInstance.getLock("String_Node_Str");
  }
 else {
    this.schemaLock=new ReentrantLock();
  }
  this.sqlgGraph.tx().afterCommit(() -> {
    this.localTemporaryTables.clear();
    if (this.isLockedByCurrentThread()) {
      for (      String schema : this.uncommittedSchemas) {
        if (distributed) {
          this.schemas.put(schema,schema);
        }
        this.localSchemas.put(schema,schema);
      }
      for (      Map.Entry<String,Map<String,PropertyType>> uncommittedTablesEntry : this.uncommittedTables.entrySet()) {
        if (distributed) {
          this.tables.put(uncommittedTablesEntry.getKey(),uncommittedTablesEntry.getValue());
        }
        this.localTables.put(uncommittedTablesEntry.getKey(),uncommittedTablesEntry.getValue());
      }
      for (      Map.Entry<String,Set<String>> uncommittedLabelSchemasEntry : this.uncommittedLabelSchemas.entrySet()) {
        Set<String> schemas=uncommittedLabelSchemasEntry.getValue();
        if (schemas == null) {
          if (distributed) {
            this.labelSchemas.put(uncommittedLabelSchemasEntry.getKey(),uncommittedLabelSchemasEntry.getValue());
          }
          this.localLabelSchemas.put(uncommittedLabelSchemasEntry.getKey(),this.uncommittedLabelSchemas.get(uncommittedLabelSchemasEntry.getKey()));
        }
 else {
          schemas.addAll(this.uncommittedLabelSchemas.get(uncommittedLabelSchemasEntry.getKey()));
          if (distributed) {
            this.labelSchemas.put(uncommittedLabelSchemasEntry.getKey(),schemas);
          }
          this.localLabelSchemas.put(uncommittedLabelSchemasEntry.getKey(),schemas);
        }
      }
      for (      Map.Entry<String,Set<String>> uncommittedEdgeForeignKeysEntry : this.uncommittedEdgeForeignKeys.entrySet()) {
        if (distributed) {
          this.edgeForeignKeys.put(uncommittedEdgeForeignKeysEntry.getKey(),uncommittedEdgeForeignKeysEntry.getValue());
        }
        this.localEdgeForeignKeys.put(uncommittedEdgeForeignKeysEntry.getKey(),uncommittedEdgeForeignKeysEntry.getValue());
      }
      for (      Map.Entry<SchemaTable,Pair<Set<SchemaTable>,Set<SchemaTable>>> schemaTableEntry : this.uncommittedTableLabels.entrySet()) {
        Pair<Set<SchemaTable>,Set<SchemaTable>> tableLabels=schemaTableEntry.getValue();
        if (tableLabels == null) {
          tableLabels=Pair.of(new HashSet<>(),new HashSet<>());
        }
        tableLabels.getLeft().addAll(schemaTableEntry.getValue().getLeft());
        tableLabels.getRight().addAll(schemaTableEntry.getValue().getRight());
        if (distributed) {
          this.tableLabels.put(schemaTableEntry.getKey(),tableLabels);
        }
        this.localTableLabels.put(schemaTableEntry.getKey(),tableLabels);
      }
      this.uncommittedSchemas.clear();
      this.uncommittedTables.clear();
      this.uncommittedLabelSchemas.clear();
      this.uncommittedEdgeForeignKeys.clear();
      this.uncommittedTableLabels.clear();
      this.schemaLock.unlock();
    }
  }
);
  this.sqlgGraph.tx().afterRollback(() -> {
    this.localTemporaryTables.clear();
    if (this.isLockedByCurrentThread()) {
      if (this.getSqlDialect().supportsTransactionalSchema()) {
        this.uncommittedSchemas.clear();
        this.uncommittedTables.clear();
        this.uncommittedLabelSchemas.clear();
        this.uncommittedEdgeForeignKeys.clear();
        this.uncommittedTableLabels.clear();
      }
 else {
        for (        String table : this.uncommittedSchemas) {
          if (distributed) {
            this.schemas.put(table,table);
          }
          this.localSchemas.put(table,table);
        }
        for (        Map.Entry<String,Map<String,PropertyType>> tableEntry : this.uncommittedTables.entrySet()) {
          if (distributed) {
            this.tables.put(tableEntry.getKey(),tableEntry.getValue());
          }
          this.localTables.put(tableEntry.getKey(),tableEntry.getValue());
        }
        for (        Map.Entry<String,Set<String>> tableEntry : this.uncommittedLabelSchemas.entrySet()) {
          Set<String> schemas=tableEntry.getValue();
          if (schemas == null) {
            if (distributed) {
              this.labelSchemas.put(tableEntry.getKey(),tableEntry.getValue());
            }
            this.localLabelSchemas.put(tableEntry.getKey(),tableEntry.getValue());
          }
 else {
            schemas.addAll(tableEntry.getValue());
            if (distributed) {
              this.labelSchemas.put(tableEntry.getKey(),schemas);
            }
            this.localLabelSchemas.put(tableEntry.getKey(),schemas);
          }
        }
        for (        Map.Entry<String,Set<String>> tableEntry : this.uncommittedEdgeForeignKeys.entrySet()) {
          if (distributed) {
            this.edgeForeignKeys.put(tableEntry.getKey(),tableEntry.getValue());
          }
          this.localEdgeForeignKeys.put(tableEntry.getKey(),tableEntry.getValue());
        }
        for (        Map.Entry<SchemaTable,Pair<Set<SchemaTable>,Set<SchemaTable>>> schemaTableEntry : this.uncommittedTableLabels.entrySet()) {
          Pair<Set<SchemaTable>,Set<SchemaTable>> tableLabels=schemaTableEntry.getValue();
          if (tableLabels == null) {
            tableLabels=Pair.of(new HashSet<>(),new HashSet<>());
          }
          tableLabels.getLeft().addAll(schemaTableEntry.getValue().getLeft());
          tableLabels.getRight().addAll(schemaTableEntry.getValue().getRight());
          if (distributed) {
            this.tableLabels.put(schemaTableEntry.getKey(),tableLabels);
          }
          this.localTableLabels.put(schemaTableEntry.getKey(),tableLabels);
        }
        this.uncommittedSchemas.clear();
        this.uncommittedTables.clear();
        this.uncommittedLabelSchemas.clear();
        this.uncommittedEdgeForeignKeys.clear();
        this.uncommittedTableLabels.clear();
      }
      this.schemaLock.unlock();
    }
  }
);
}

Fixed version (ground truth):
SchemaManager(SqlgGraph sqlgGraph,SqlDialect sqlDialect,Configuration configuration){
  this.sqlgGraph=sqlgGraph;
  this.sqlDialect=sqlDialect;
  this.distributed=configuration.getBoolean("String_Node_Str",false);
  if (this.distributed) {
    this.hazelcastInstance=Hazelcast.newHazelcastInstance(configHazelcast(configuration));
    this.schemas=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + SCHEMAS_HAZELCAST_MAP);
    this.labelSchemas=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + LABEL_SCHEMAS_HAZELCAST_MAP);
    this.tables=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + TABLES_HAZELCAST_MAP);
    this.edgeForeignKeys=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + EDGE_FOREIGN_KEYS_HAZELCAST_MAP);
    this.tableLabels=this.hazelcastInstance.getMap(this.sqlgGraph.getConfiguration().getString("String_Node_Str") + TABLE_LABELS_HAZELCAST_MAP);
    ((IMap)this.schemas).addEntryListener(new SchemasMapEntryListener(),true);
    ((IMap)this.labelSchemas).addEntryListener(new LabelSchemasMapEntryListener(),true);
    ((IMap)this.tables).addEntryListener(new TablesMapEntryListener(),true);
    ((IMap)this.edgeForeignKeys).addEntryListener(new EdgeForeignKeysMapEntryListener(),true);
    ((IMap)this.tableLabels).addEntryListener(new TableLabelMapEntryListener(),true);
    this.schemaLock=this.hazelcastInstance.getLock("String_Node_Str");
  }
 else {
    this.schemaLock=new ReentrantLock();
  }
  this.sqlgGraph.tx().afterCommit(() -> {
    this.localTemporaryTables.clear();
    if (this.isLockedByCurrentThread()) {
      for (      String schema : this.uncommittedSchemas) {
        if (distributed) {
          this.schemas.put(schema,schema);
        }
        this.localSchemas.put(schema,schema);
      }
      for (      Map.Entry<String,Map<String,PropertyType>> uncommittedTablesEntry : this.uncommittedTables.entrySet()) {
        if (distributed) {
          this.tables.put(uncommittedTablesEntry.getKey(),uncommittedTablesEntry.getValue());
        }
        this.localTables.put(uncommittedTablesEntry.getKey(),uncommittedTablesEntry.getValue());
      }
      for (      Map.Entry<String,Set<String>> uncommittedLabelSchemasEntry : this.uncommittedLabelSchemas.entrySet()) {
        Set<String> schemas=this.localLabelSchemas.get(uncommittedLabelSchemasEntry.getKey());
        if (schemas == null) {
          if (distributed) {
            this.labelSchemas.put(uncommittedLabelSchemasEntry.getKey(),uncommittedLabelSchemasEntry.getValue());
          }
          this.localLabelSchemas.put(uncommittedLabelSchemasEntry.getKey(),uncommittedLabelSchemasEntry.getValue());
        }
 else {
          schemas.addAll(this.uncommittedLabelSchemas.get(uncommittedLabelSchemasEntry.getKey()));
          if (distributed) {
            this.labelSchemas.put(uncommittedLabelSchemasEntry.getKey(),schemas);
          }
          this.localLabelSchemas.put(uncommittedLabelSchemasEntry.getKey(),schemas);
        }
      }
      for (      Map.Entry<String,Set<String>> uncommittedEdgeForeignKeysEntry : this.uncommittedEdgeForeignKeys.entrySet()) {
        if (distributed) {
          this.edgeForeignKeys.put(uncommittedEdgeForeignKeysEntry.getKey(),uncommittedEdgeForeignKeysEntry.getValue());
        }
        this.localEdgeForeignKeys.put(uncommittedEdgeForeignKeysEntry.getKey(),uncommittedEdgeForeignKeysEntry.getValue());
      }
      for (      Map.Entry<SchemaTable,Pair<Set<SchemaTable>,Set<SchemaTable>>> schemaTableEntry : this.uncommittedTableLabels.entrySet()) {
        Pair<Set<SchemaTable>,Set<SchemaTable>> tableLabels=this.localTableLabels.get(schemaTableEntry.getKey());
        if (tableLabels == null) {
          tableLabels=Pair.of(new HashSet<>(),new HashSet<>());
        }
        tableLabels.getLeft().addAll(schemaTableEntry.getValue().getLeft());
        tableLabels.getRight().addAll(schemaTableEntry.getValue().getRight());
        if (distributed) {
          this.tableLabels.put(schemaTableEntry.getKey(),tableLabels);
        }
        this.localTableLabels.put(schemaTableEntry.getKey(),tableLabels);
      }
      this.uncommittedSchemas.clear();
      this.uncommittedTables.clear();
      this.uncommittedLabelSchemas.clear();
      this.uncommittedEdgeForeignKeys.clear();
      this.uncommittedTableLabels.clear();
      this.schemaLock.unlock();
    }
  }
);
  this.sqlgGraph.tx().afterRollback(() -> {
    this.localTemporaryTables.clear();
    if (this.isLockedByCurrentThread()) {
      if (this.getSqlDialect().supportsTransactionalSchema()) {
        this.uncommittedSchemas.clear();
        this.uncommittedTables.clear();
        this.uncommittedLabelSchemas.clear();
        this.uncommittedEdgeForeignKeys.clear();
        this.uncommittedTableLabels.clear();
      }
 else {
        for (        String table : this.uncommittedSchemas) {
          if (distributed) {
            this.schemas.put(table,table);
          }
          this.localSchemas.put(table,table);
        }
        for (        Map.Entry<String,Map<String,PropertyType>> tableEntry : this.uncommittedTables.entrySet()) {
          if (distributed) {
            this.tables.put(tableEntry.getKey(),tableEntry.getValue());
          }
          this.localTables.put(tableEntry.getKey(),tableEntry.getValue());
        }
        for (        Map.Entry<String,Set<String>> tableEntry : this.uncommittedLabelSchemas.entrySet()) {
          Set<String> schemas=this.localLabelSchemas.get(tableEntry.getKey());
          if (schemas == null) {
            if (distributed) {
              this.labelSchemas.put(tableEntry.getKey(),tableEntry.getValue());
            }
            this.localLabelSchemas.put(tableEntry.getKey(),tableEntry.getValue());
          }
 else {
            schemas.addAll(tableEntry.getValue());
            if (distributed) {
              this.labelSchemas.put(tableEntry.getKey(),schemas);
            }
            this.localLabelSchemas.put(tableEntry.getKey(),schemas);
          }
        }
        for (        Map.Entry<String,Set<String>> tableEntry : this.uncommittedEdgeForeignKeys.entrySet()) {
          if (distributed) {
            this.edgeForeignKeys.put(tableEntry.getKey(),tableEntry.getValue());
          }
          this.localEdgeForeignKeys.put(tableEntry.getKey(),tableEntry.getValue());
        }
        for (        Map.Entry<SchemaTable,Pair<Set<SchemaTable>,Set<SchemaTable>>> schemaTableEntry : this.uncommittedTableLabels.entrySet()) {
          Pair<Set<SchemaTable>,Set<SchemaTable>> tableLabels=this.localTableLabels.get(schemaTableEntry.getKey());
          if (tableLabels == null) {
            tableLabels=Pair.of(new HashSet<>(),new HashSet<>());
          }
          tableLabels.getLeft().addAll(schemaTableEntry.getValue().getLeft());
          tableLabels.getRight().addAll(schemaTableEntry.getValue().getRight());
          if (distributed) {
            this.tableLabels.put(schemaTableEntry.getKey(),tableLabels);
          }
          this.localTableLabels.put(schemaTableEntry.getKey(),tableLabels);
        }
        this.uncommittedSchemas.clear();
        this.uncommittedTables.clear();
        this.uncommittedLabelSchemas.clear();
        this.uncommittedEdgeForeignKeys.clear();
        this.uncommittedTableLabels.clear();
      }
      this.schemaLock.unlock();
    }
  }
);
}