nus-yam/ex-repair huggingface dataset:
Program: 166871
Project: 166871
Buggy source:
private void refreshMinTrackDurationInSeconds(){
  final int minTrackDurationInSeconds=WAILSettings.getMinTrackDurationInSeconds(getActivity());
  minDurationInPercentsDescription.setText(getString(R.string.settings_min_track_elapsed_time_in_seconds_desc,minTrackDurationInSeconds + "String_Node_Str" + WordFormUtil.getWordForm(minTrackDurationInSeconds,getResources().getStringArray(R.array.word_forms_second))));
}

Fixed version (ground truth):
private void refreshMinTrackDurationInSeconds(){
  final int minTrackDurationInSeconds=WAILSettings.getMinTrackDurationInSeconds(getActivity());
  minDurationInSecondsDescription.setText(getString(R.string.settings_min_track_elapsed_time_in_seconds_desc,minTrackDurationInSeconds + "String_Node_Str" + WordFormUtil.getWordForm(minTrackDurationInSeconds,getResources().getStringArray(R.array.word_forms_second))));
}
Program: 166874
Project: 166874
Buggy source:
private String internalConstructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,boolean isTemp,String schema,String table,Set<String> keys){
  Map<String,PropertyType> propertyTypeMap;
  if (isTemp) {
    propertyTypeMap=sqlgGraph.getTopology().getPublicSchema().getTemporaryTable(VERTEX_PREFIX + table);
  }
 else {
    propertyTypeMap=sqlgGraph.getTopology().getTableFor(SchemaTable.of(schema,VERTEX_PREFIX + table));
  }
  StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str");
  if (!isTemp) {
    sql.append(maybeWrapInQoutes(schema));
    sql.append("String_Node_Str");
  }
  sql.append(maybeWrapInQoutes(VERTEX_PREFIX + table));
  sql.append("String_Node_Str");
  if (keys.isEmpty()) {
    Map<String,PropertyType> columns=new HashMap<>();
    columns.put(COPY_DUMMY,PropertyType.from(0));
    sqlgGraph.getTopology().ensureVertexLabelPropertiesExist(schema,table,columns);
    sql.append(maybeWrapInQoutes(COPY_DUMMY));
  }
 else {
    int count=1;
    for (    String key : keys) {
      if (count > 1 && count <= keys.size()) {
        sql.append("String_Node_Str");
      }
      count++;
      appendKeyForStream(propertyTypeMap.get(key),sql,key);
    }
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_DELIMITER);
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_QUOTE);
  sql.append("String_Node_Str");
  sql.append(ESCAPE);
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(BATCH_NULL);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}

Fixed version (ground truth):
private String internalConstructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,boolean isTemp,String schema,String table,Set<String> keys){
  Map<String,PropertyType> propertyTypeMap;
  if (isTemp) {
    propertyTypeMap=sqlgGraph.getTopology().getPublicSchema().getTemporaryTable(VERTEX_PREFIX + table);
  }
 else {
    propertyTypeMap=sqlgGraph.getTopology().getTableFor(SchemaTable.of(schema,VERTEX_PREFIX + table));
  }
  StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str");
  if (!isTemp) {
    sql.append(maybeWrapInQoutes(schema));
    sql.append("String_Node_Str");
  }
  sql.append(maybeWrapInQoutes(VERTEX_PREFIX + table));
  sql.append("String_Node_Str");
  for (  String key : keys) {
    sql.append("String_Node_Str");
    appendKeyForStream(propertyTypeMap.get(key),sql,key);
  }
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_DELIMITER);
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(COPY_COMMAND_QUOTE);
  sql.append("String_Node_Str");
  sql.append(ESCAPE);
  sql.append("String_Node_Str");
  sql.append("String_Node_Str");
  sql.append(BATCH_NULL);
  sql.append("String_Node_Str");
  if (logger.isDebugEnabled()) {
    logger.debug(sql.toString());
  }
  return sql.toString();
}
Program: 166875
Project: 166875
Buggy source:
@Test public void testMultiThreadAddVertex() throws InterruptedException {
  sqlgGraph.tx().rollback();
  Set<Integer> tables=new ConcurrentSkipListSet<>();
  ExecutorService executorService=Executors.newFixedThreadPool(1);
  for (int j=0; j < 50; j++) {
    executorService.submit(() -> {
      sqlgGraph.tx().rollback();
      sqlgGraph.tx().normalBatchModeOn();
      final Random random=new Random();
      int randomInt=random.nextInt();
      try {
        for (int i=0; i < 1000; i++) {
          Vertex v1=sqlgGraph.addVertex(T.label,"String_Node_Str" + String.valueOf(randomInt),"String_Node_Str",randomInt);
          Vertex v2=sqlgGraph.addVertex(T.label,"String_Node_Str" + String.valueOf(randomInt),"String_Node_Str",randomInt);
          v1.addEdge(String.valueOf(randomInt),v2,"String_Node_Str",randomInt);
          tables.add(randomInt);
        }
        sqlgGraph.tx().commit();
        sqlgGraph.tx().normalBatchModeOn();
      }
 catch (      Exception e) {
        Assert.fail(e.getMessage());
      }
    }
);
  }
  executorService.shutdown();
  executorService.awaitTermination(60000,TimeUnit.SECONDS);
  Assert.assertEquals(50,tables.size());
  testNultiThreadAddVertex_assert(this.sqlgGraph,tables);
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    testNultiThreadAddVertex_assert(this.sqlgGraph1,tables);
  }
}

Fixed version (ground truth):
@Test public void testMultiThreadAddVertex() throws InterruptedException {
  sqlgGraph.tx().rollback();
  Set<Integer> tables=new ConcurrentSkipListSet<>();
  ExecutorService executorService=Executors.newFixedThreadPool(2);
  for (int j=0; j < 50; j++) {
    executorService.submit(() -> {
      sqlgGraph.tx().rollback();
      sqlgGraph.tx().normalBatchModeOn();
      final Random random=new Random();
      int randomInt=random.nextInt();
      try {
        for (int i=0; i < 1000; i++) {
          Vertex v1=sqlgGraph.addVertex(T.label,"String_Node_Str" + String.valueOf(randomInt),"String_Node_Str",randomInt);
          Vertex v2=sqlgGraph.addVertex(T.label,"String_Node_Str" + String.valueOf(randomInt),"String_Node_Str",randomInt);
          v1.addEdge(String.valueOf(randomInt),v2,"String_Node_Str",randomInt);
        }
        tables.add(randomInt);
        sqlgGraph.tx().commit();
        sqlgGraph.tx().normalBatchModeOn();
      }
 catch (      Exception e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
      }
    }
);
  }
  executorService.shutdown();
  executorService.awaitTermination(60000,TimeUnit.SECONDS);
  Assert.assertEquals(50,tables.size());
  testMultiThreadAddVertex_assert(this.sqlgGraph,tables);
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    testMultiThreadAddVertex_assert(this.sqlgGraph1,tables);
  }
}
Program: 166877
Project: 166877
Buggy source:
@Override public String constructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,String schema,String table,Set<String> keys){
  return internalConstructCompleteCopyCommandSqlVertex(sqlgGraph,false,schema,table,keys);
}

Fixed version (ground truth):
@Override public String constructCompleteCopyCommandSqlVertex(SqlgGraph sqlgGraph,String schema,String table,Set<String> keys){
  return internalConstructCompleteCopyCommandSqlVertex(sqlgGraph,false,schema,table,false,keys);
}
Program: 166879
Project: 166879
Buggy source:
@Override public String constructCompleteCopyCommandTemporarySqlVertex(SqlgGraph sqlgGraph,SqlgVertex vertex,Map<String,Object> keyValueMap){
  return internalConstructCompleteCopyCommandSqlVertex(sqlgGraph,true,vertex,keyValueMap);
}

Fixed version (ground truth):
@Override public String constructCompleteCopyCommandTemporarySqlVertex(SqlgGraph sqlgGraph,SqlgVertex vertex,Map<String,Object> keyValueMap){
  return internalConstructCompleteCopyCommandSqlVertex(sqlgGraph,true,vertex,false,keyValueMap);
}
Program: 166881
Project: 166881
Buggy source:
void add(PreparedStatement preparedStatement){
  this.cache.add(preparedStatement);
}

Fixed version (ground truth):
void add(PreparedStatement preparedStatement){
  this.cache.put(preparedStatement,Boolean.TRUE);
}
Program: 166882
Project: 166882
Buggy source:
public void close() throws SQLException {
  for (  PreparedStatement preparedStatement : this.cache) {
    preparedStatement.close();
  }
  this.cache.clear();
}

Fixed version (ground truth):
public void close() throws SQLException {
  for (  PreparedStatement preparedStatement : this.cache.keySet()) {
    preparedStatement.close();
  }
  this.cache.clear();
}
Program: 166883
Project: 166883
Buggy source:
private void closePreparedStatement(){
  if (this.queryResult != null) {
    try {
      this.queryResult.getRight().close();
      this.queryResult=null;
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
private void closePreparedStatement(){
  if (this.queryResult != null) {
    try {
      this.queryResult.getRight().close();
      this.sqlgGraph.tx().getPreparedStatementCache().remove(this.queryResult.getRight());
      this.queryResult=null;
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 166884
Project: 166884
Buggy source:
private String printLabeledOuterFromClauseFor(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  int count=1;
  for (  String propertyName : propertyTypeMap.keySet()) {
    sql+="String_Node_Str" + counter + "String_Node_Str";
    sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.labeledMappedAliasPropertyNameForOuterFromClause(propertyName,columnNameAliasMapCopy));
    if (count++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  return sql;
}

Fixed version (ground truth):
private String printLabeledOuterFromClauseFor(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  int count=1;
  for (  Map.Entry<String,PropertyType> property : propertyTypeMap.entrySet()) {
    sql+="String_Node_Str" + counter + "String_Node_Str";
    String alias=this.labeledMappedAliasPropertyNameForOuterFromClause(property.getKey(),columnNameAliasMapCopy);
    sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(alias);
    for (    String postFix : property.getValue().getPostFixes()) {
      sql+="String_Node_Str";
      alias=this.mappedAliasPropertyName(property.getKey() + postFix,columnNameAliasMapCopy);
      sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(alias);
    }
    if (count++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  return sql;
}
Program: 166885
Project: 166885
Buggy source:
private String printLabeledOuterFromClauseFor(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  int count=1;
  for (  String propertyName : propertyTypeMap.keySet()) {
    sql+="String_Node_Str" + counter + "String_Node_Str";
    sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.labeledMappedAliasPropertyNameForOuterFromClause(propertyName,columnNameAliasMapCopy));
    if (count++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  return sql;
}

Fixed version (ground truth):
private String printLabeledOuterFromClauseFor(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  int count=1;
  for (  Map.Entry<String,PropertyType> property : propertyTypeMap.entrySet()) {
    sql+="String_Node_Str" + counter + "String_Node_Str";
    String alias=this.labeledMappedAliasPropertyNameForOuterFromClause(property.getKey(),columnNameAliasMapCopy);
    sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(alias);
    for (    String postFix : property.getValue().getPostFixes()) {
      sql+="String_Node_Str";
      alias=this.mappedAliasPropertyName(property.getKey() + postFix,columnNameAliasMapCopy);
      sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(alias);
    }
    if (count++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  return sql;
}
Program: 166888
Project: 166888
Buggy source:
void addToEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys == null) {
    foreignKeys=new HashSet<>();
    foreignKeys.add(foreignKey);
    this.edgeForeignKeyCache.put(name,foreignKeys);
  }
 else {
    foreignKeys.add(foreignKey);
  }
}

Fixed version (ground truth):
void addToEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys == null) {
    foreignKeys=new HashSet<>();
    this.edgeForeignKeyCache.put(name,foreignKeys);
  }
  foreignKeys.add(foreignKey);
}
Program: 166889
Project: 166889
Buggy source:
/** 
 * remove a given schema
 * @param schema       the schema
 * @param preserveData should we preserve the SQL data?
 */
void removeSchema(Schema schema,boolean preserveData){
  lock();
  if (!this.uncommittedRemovedSchemas.contains(schema.getName())) {
    for (    VertexLabel vlbl : schema.getVertexLabels().values()) {
      for (      EdgeRole er : vlbl.getInEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() != schema) {
          er.remove(preserveData);
        }
      }
    }
    this.uncommittedRemovedSchemas.add(schema.getName());
    TopologyManager.removeSchema(sqlgGraph,schema.getName());
    if (!preserveData) {
      schema.delete();
    }
    fire(schema,"String_Node_Str",TopologyChangeAction.DELETE);
  }
}

Fixed version (ground truth):
/** 
 * remove a given schema
 * @param schema       the schema
 * @param preserveData should we preserve the SQL data?
 */
void removeSchema(Schema schema,boolean preserveData){
  lock();
  if (!this.uncommittedRemovedSchemas.contains(schema.getName())) {
    for (    VertexLabel vlbl : schema.getVertexLabels().values()) {
      for (      EdgeRole er : vlbl.getInEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() != schema) {
          er.remove(preserveData);
        }
      }
      for (      EdgeRole er : vlbl.getOutEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() == schema) {
          for (          EdgeRole erIn : er.getEdgeLabel().getInEdgeRoles()) {
            if (erIn.getVertexLabel().getSchema() != schema) {
              erIn.remove(preserveData);
            }
          }
        }
      }
    }
    this.uncommittedRemovedSchemas.add(schema.getName());
    TopologyManager.removeSchema(sqlgGraph,schema.getName());
    if (!preserveData) {
      schema.delete();
    }
    fire(schema,"String_Node_Str",TopologyChangeAction.DELETE);
  }
}
Program: 166890
Project: 166890
Buggy source:
void removeFromEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys != null) {
    foreignKeys.remove(foreignKey);
  }
  if (foreignKeys.isEmpty()) {
    this.edgeForeignKeyCache.remove(name);
  }
}

Fixed version (ground truth):
void removeFromEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys != null) {
    foreignKeys.remove(foreignKey);
    if (foreignKeys.isEmpty()) {
      this.edgeForeignKeyCache.remove(name);
    }
  }
}
Program: 166891
Project: 166891
Buggy source:
private void toSql(SqlgGraph sqlgGraph,SchemaTableTree schemaTableTree,StringBuilder result,int depth){
  if (!this.hasContainers.isEmpty()) {
    boolean first=true;
    for (    HasContainer h : this.hasContainers) {
      if (!SqlgUtil.isBulkWithin(sqlgGraph,h)) {
        if (first) {
          first=false;
          result.append("String_Node_Str");
        }
        WhereClause whereClause=WhereClause.from(h.getPredicate());
        result.append(whereClause.toSql(sqlgGraph,schemaTableTree,h));
      }
    }
    if (!first) {
      result.append("String_Node_Str");
    }
  }
  int count=1;
  if (!this.andOrHasContainers.isEmpty()) {
    result.append("String_Node_Str");
    for (int i=0; i < depth; i++) {
      result.append("String_Node_Str");
    }
    result.append("String_Node_Str");
  }
  for (  AndOrHasContainer andOrHasContainer : this.andOrHasContainers) {
    andOrHasContainer.toSql(sqlgGraph,schemaTableTree,result,depth + 1);
    if (count++ < this.andOrHasContainers.size()) {
switch (this.type) {
case AND:
        result.append("String_Node_Str");
      break;
case OR:
    result.append("String_Node_Str");
  break;
case NONE:
break;
}
}
}
if (!this.andOrHasContainers.isEmpty()) {
result.append("String_Node_Str");
for (int i=0; i < depth - 1; i++) {
result.append("String_Node_Str");
}
result.append("String_Node_Str");
}
}

Fixed version (ground truth):
private void toSql(SqlgGraph sqlgGraph,SchemaTableTree schemaTableTree,StringBuilder result,int depth){
  if (!this.hasContainers.isEmpty()) {
    boolean first=true;
    for (    HasContainer h : this.hasContainers) {
      if (!SqlgUtil.isBulkWithin(sqlgGraph,h)) {
        if (first) {
          first=false;
          result.append("String_Node_Str");
        }
 else {
          result.append("String_Node_Str");
        }
        WhereClause whereClause=WhereClause.from(h.getPredicate());
        result.append(whereClause.toSql(sqlgGraph,schemaTableTree,h));
      }
    }
    if (!first) {
      result.append("String_Node_Str");
    }
  }
  int count=1;
  if (!this.andOrHasContainers.isEmpty()) {
    result.append("String_Node_Str");
    for (int i=0; i < depth; i++) {
      result.append("String_Node_Str");
    }
    result.append("String_Node_Str");
  }
  for (  AndOrHasContainer andOrHasContainer : this.andOrHasContainers) {
    andOrHasContainer.toSql(sqlgGraph,schemaTableTree,result,depth + 1);
    if (count++ < this.andOrHasContainers.size()) {
switch (this.type) {
case AND:
        result.append("String_Node_Str");
      break;
case OR:
    result.append("String_Node_Str");
  break;
case NONE:
break;
}
}
}
if (!this.andOrHasContainers.isEmpty()) {
result.append("String_Node_Str");
for (int i=0; i < depth - 1; i++) {
result.append("String_Node_Str");
}
result.append("String_Node_Str");
}
}
Program: 166892
Project: 166892
Buggy source:
public static TYPE from(ConnectiveStep connectiveStep){
  if (connectiveStep instanceof AndStep) {
    return AND;
  }
 else   if (connectiveStep instanceof OrStep) {
    return OR;
  }
 else {
    return NONE;
  }
}

Fixed version (ground truth):
public static TYPE from(ConnectiveStep<?> connectiveStep){
  if (connectiveStep instanceof AndStep) {
    return AND;
  }
 else   if (connectiveStep instanceof OrStep) {
    return OR;
  }
 else {
    return NONE;
  }
}
Program: 166893
Project: 166893
Buggy source:
@Test public void testOrStepOptimizedWith3Ors(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a2=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a3=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a4=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").or(__.has("String_Node_Str","String_Node_Str"),__.has("String_Node_Str","String_Node_Str"),__.has("String_Node_Str","String_Node_Str"));
  List<Vertex> vertices=traversal.toList();
  Assert.assertEquals(1,traversal.getSteps().size());
  Assert.assertEquals(3,vertices.size());
  Assert.assertTrue(vertices.contains(a1) && vertices.contains(a2) && vertices.contains(a3));
}

Fixed version (ground truth):
@Test public void testOrStepOptimizedWith3Ors(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a2=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a3=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").or(__.has("String_Node_Str","String_Node_Str"),__.has("String_Node_Str","String_Node_Str"),__.has("String_Node_Str","String_Node_Str"));
  List<Vertex> vertices=traversal.toList();
  Assert.assertEquals(1,traversal.getSteps().size());
  Assert.assertEquals(3,vertices.size());
  Assert.assertTrue(vertices.contains(a1) && vertices.contains(a2) && vertices.contains(a3));
}
Program: 166894
Project: 166894
Buggy source:
void addToEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys == null) {
    foreignKeys=new HashSet<>();
    foreignKeys.add(foreignKey);
    this.edgeForeignKeyCache.put(name,foreignKeys);
  }
 else {
    foreignKeys.add(foreignKey);
  }
}

Fixed version (ground truth):
void addToEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys == null) {
    foreignKeys=new HashSet<>();
    this.edgeForeignKeyCache.put(name,foreignKeys);
  }
  foreignKeys.add(foreignKey);
}
Program: 166895
Project: 166895
Buggy source:
/** 
 * remove a given schema
 * @param schema       the schema
 * @param preserveData should we preserve the SQL data?
 */
void removeSchema(Schema schema,boolean preserveData){
  lock();
  if (!this.uncommittedRemovedSchemas.contains(schema.getName())) {
    for (    VertexLabel vlbl : schema.getVertexLabels().values()) {
      for (      EdgeRole er : vlbl.getInEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() != schema) {
          er.remove(preserveData);
        }
      }
    }
    this.uncommittedRemovedSchemas.add(schema.getName());
    TopologyManager.removeSchema(sqlgGraph,schema.getName());
    if (!preserveData) {
      schema.delete();
    }
    fire(schema,"String_Node_Str",TopologyChangeAction.DELETE);
  }
}

Fixed version (ground truth):
/** 
 * remove a given schema
 * @param schema       the schema
 * @param preserveData should we preserve the SQL data?
 */
void removeSchema(Schema schema,boolean preserveData){
  lock();
  if (!this.uncommittedRemovedSchemas.contains(schema.getName())) {
    for (    VertexLabel vlbl : schema.getVertexLabels().values()) {
      for (      EdgeRole er : vlbl.getInEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() != schema) {
          er.remove(preserveData);
        }
      }
      for (      EdgeRole er : vlbl.getOutEdgeRoles().values()) {
        if (er.getEdgeLabel().getSchema() == schema) {
          for (          EdgeRole erIn : er.getEdgeLabel().getInEdgeRoles()) {
            if (erIn.getVertexLabel().getSchema() != schema) {
              erIn.remove(preserveData);
            }
          }
        }
      }
    }
    this.uncommittedRemovedSchemas.add(schema.getName());
    TopologyManager.removeSchema(sqlgGraph,schema.getName());
    if (!preserveData) {
      schema.delete();
    }
    fire(schema,"String_Node_Str",TopologyChangeAction.DELETE);
  }
}
Program: 166896
Project: 166896
Buggy source:
void removeFromEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys != null) {
    foreignKeys.remove(foreignKey);
  }
  if (foreignKeys.isEmpty()) {
    this.edgeForeignKeyCache.remove(name);
  }
}

Fixed version (ground truth):
void removeFromEdgeForeignKeyCache(String name,String foreignKey){
  Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread());
  Set<String> foreignKeys=this.edgeForeignKeyCache.get(name);
  if (foreignKeys != null) {
    foreignKeys.remove(foreignKey);
    if (foreignKeys.isEmpty()) {
      this.edgeForeignKeyCache.remove(name);
    }
  }
}
Program: 166898
Project: 166898
Buggy source:
private void testEqualsZonedDateTime2_assert(SqlgGraph sqlgGraph,ZonedDateTime born2){
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)sqlgGraph.traversal().V().hasLabel("String_Node_Str").has("String_Node_Str",P.gt(born2));
  Assert.assertEquals(2,traversal.getSteps().size());
  List<Vertex> vertices=traversal.toList();
  Assert.assertEquals(1,traversal.getSteps().size());
  Assert.assertEquals(1,vertices.size());
}

Fixed version (ground truth):
private void testEqualsZonedDateTime2_assert(SqlgGraph sqlgGraph,ZonedDateTime born2){
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)sqlgGraph.traversal().V().hasLabel("String_Node_Str").has("String_Node_Str",P.gt(born2));
  Assert.assertEquals(2,traversal.getSteps().size());
  List<Vertex> vertices=traversal.toList();
  Assert.assertEquals(2,traversal.getSteps().size());
  Assert.assertEquals(1,vertices.size());
}
Program: 166900
Project: 166900
Buggy source:
@Override public SqlgDataSource setup(String driver,Configuration configuration) throws Exception {
  Preconditions.checkState(configuration.containsKey(SqlgGraph.JDBC_URL));
  Preconditions.checkState(configuration.containsKey("String_Node_Str"));
  Preconditions.checkState(configuration.containsKey("String_Node_Str"));
  String connectURI=configuration.getString(SqlgGraph.JDBC_URL);
  String username=configuration.getString("String_Node_Str");
  String password=configuration.getString("String_Node_Str");
  ComboPooledDataSource comboPooledDataSource=new ComboPooledDataSource();
  comboPooledDataSource.setDriverClass(driver);
  comboPooledDataSource.setJdbcUrl(connectURI);
  comboPooledDataSource.setMaxPoolSize(configuration.getInt("String_Node_Str",100));
  comboPooledDataSource.setMaxIdleTime(configuration.getInt("String_Node_Str",3600));
  comboPooledDataSource.setForceUseNamedDriverClass(true);
  if (!StringUtils.isEmpty(username)) {
    comboPooledDataSource.setUser(username);
  }
  if (!StringUtils.isEmpty(username)) {
    comboPooledDataSource.setPassword(password);
  }
  return new C3P0DataSource(connectURI,comboPooledDataSource);
}

Fixed version (ground truth):
@Override public SqlgDataSource setup(String driver,Configuration configuration) throws Exception {
  Preconditions.checkState(configuration.containsKey(SqlgGraph.JDBC_URL));
  Preconditions.checkState(configuration.containsKey("String_Node_Str"));
  Preconditions.checkState(configuration.containsKey("String_Node_Str"));
  String connectURI=configuration.getString(SqlgGraph.JDBC_URL);
  String username=configuration.getString("String_Node_Str");
  String password=configuration.getString("String_Node_Str");
  ComboPooledDataSource comboPooledDataSource=new ComboPooledDataSource();
  comboPooledDataSource.setDriverClass(driver);
  comboPooledDataSource.setJdbcUrl(connectURI);
  comboPooledDataSource.setMaxPoolSize(configuration.getInt("String_Node_Str",100));
  comboPooledDataSource.setMaxIdleTime(configuration.getInt("String_Node_Str",3600));
  comboPooledDataSource.setForceUseNamedDriverClass(true);
  if (!StringUtils.isEmpty(username)) {
    comboPooledDataSource.setUser(username);
  }
  if (!StringUtils.isEmpty(password)) {
    comboPooledDataSource.setPassword(password);
  }
  return new C3P0DataSource(connectURI,comboPooledDataSource);
}
Program: 166901
Project: 166901
Buggy source:
private static String constructOuterOrderByClause(SqlgGraph sqlgGraph,List<LinkedList<SchemaTableTree>> subQueryLinkedLists){
  String result="String_Node_Str";
  int countOuter=1;
  MutableBoolean mutableOrderBy=new MutableBoolean(false);
  for (  LinkedList<SchemaTableTree> subQueryLinkedList : subQueryLinkedLists) {
    int countInner=1;
    for (    SchemaTableTree schemaTableTree : subQueryLinkedList) {
      if (countOuter == subQueryLinkedLists.size() && countInner == subQueryLinkedList.size()) {
        result+=schemaTableTree.toOrderByClause(sqlgGraph,mutableOrderBy,countOuter);
        result+=schemaTableTree.toRangeClause(sqlgGraph,mutableOrderBy);
      }
      countInner++;
    }
    countOuter++;
  }
  return result;
}

Fixed version (ground truth):
private static String constructOuterOrderByClause(SqlgGraph sqlgGraph,List<LinkedList<SchemaTableTree>> subQueryLinkedLists){
  String result="String_Node_Str";
  int countOuter=1;
  int winningOrder=0;
  for (  LinkedList<SchemaTableTree> subQueryLinkedList : subQueryLinkedLists) {
    if (!subQueryLinkedList.isEmpty()) {
      SchemaTableTree schemaTableTree=subQueryLinkedList.peekLast();
      if (!schemaTableTree.getDbComparators().isEmpty()) {
        winningOrder=countOuter;
      }
    }
    countOuter++;
  }
  countOuter=1;
  MutableBoolean mutableOrderBy=new MutableBoolean(false);
  for (  LinkedList<SchemaTableTree> subQueryLinkedList : subQueryLinkedLists) {
    if (!subQueryLinkedList.isEmpty()) {
      SchemaTableTree schemaTableTree=subQueryLinkedList.peekLast();
      if (countOuter == winningOrder) {
        result+=schemaTableTree.toOrderByClause(sqlgGraph,mutableOrderBy,countOuter);
      }
      result+=schemaTableTree.toRangeClause(sqlgGraph,mutableOrderBy);
    }
    countOuter++;
  }
  return result;
}
Program: 166902
Project: 166902
Buggy source:
@Test public void testOrderOnEdgeWithInV(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b2=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b3=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Edge e1=a1.addEdge("String_Node_Str",b1,"String_Node_Str",0);
  Edge e2=a1.addEdge("String_Node_Str",b2,"String_Node_Str",11);
  Edge e3=a1.addEdge("String_Node_Str",b3,"String_Node_Str",2);
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)this.sqlgGraph.traversal().V(a1.id()).hasLabel("String_Node_Str").outE().order().by("String_Node_Str",Order.decr).inV();
  Assert.assertEquals(5,traversal.getSteps().size());
  List<Vertex> vertices=traversal.toList();
  Assert.assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  Assert.assertEquals(3,vertices.size());
  Assert.assertEquals(b2,vertices.get(0));
  Assert.assertEquals(b3,vertices.get(1));
  Assert.assertEquals(b1,vertices.get(2));
}

Fixed version (ground truth):
@Test public void testOrderOnEdgeWithInV(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b2=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b3=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  a1.addEdge("String_Node_Str",b1,"String_Node_Str",0);
  a1.addEdge("String_Node_Str",b2,"String_Node_Str",11);
  a1.addEdge("String_Node_Str",b3,"String_Node_Str",2);
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Vertex> traversal=(DefaultGraphTraversal<Vertex,Vertex>)this.sqlgGraph.traversal().V(a1.id()).outE("String_Node_Str").order().by("String_Node_Str",Order.decr).inV();
  assertEquals(4,traversal.getSteps().size());
  List<Vertex> vertices=traversal.toList();
  assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  assertEquals(3,vertices.size());
  assertEquals(b2,vertices.get(0));
  assertEquals(b3,vertices.get(1));
  assertEquals(b1,vertices.get(2));
  traversal=(DefaultGraphTraversal<Vertex,Vertex>)this.sqlgGraph.traversal().V(a1.id()).outE("String_Node_Str").order().by("String_Node_Str",Order.incr).inV();
  assertEquals(4,traversal.getSteps().size());
  vertices=traversal.toList();
  assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  assertEquals(3,vertices.size());
  assertEquals(b1,vertices.get(0));
  assertEquals(b3,vertices.get(1));
  assertEquals(b2,vertices.get(2));
}
Program: 166903
Project: 166903
Buggy source:
@Test public void testOrderOnEdge(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b2=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b3=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Edge e1=a1.addEdge("String_Node_Str",b1,"String_Node_Str",0);
  Edge e2=a1.addEdge("String_Node_Str",b2,"String_Node_Str",1);
  Edge e3=a1.addEdge("String_Node_Str",b3,"String_Node_Str",2);
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Edge> traversal=(DefaultGraphTraversal<Vertex,Edge>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").outE().order().by("String_Node_Str",Order.decr);
  Assert.assertEquals(4,traversal.getSteps().size());
  List<Edge> edges=traversal.toList();
  Assert.assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  Assert.assertEquals(3,edges.size());
  Assert.assertEquals(e3,edges.get(0));
  Assert.assertEquals(e2,edges.get(1));
  Assert.assertEquals(e1,edges.get(2));
}

Fixed version (ground truth):
@Test public void testOrderOnEdge(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b2=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Vertex b3=this.sqlgGraph.addVertex(T.label,"String_Node_Str");
  Edge e1=a1.addEdge("String_Node_Str",b1,"String_Node_Str",0);
  Edge e2=a1.addEdge("String_Node_Str",b2,"String_Node_Str",1);
  Edge e3=a1.addEdge("String_Node_Str",b3,"String_Node_Str",2);
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Edge> traversal=(DefaultGraphTraversal<Vertex,Edge>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").outE().order().by("String_Node_Str",Order.decr);
  assertEquals(4,traversal.getSteps().size());
  List<Edge> edges=traversal.toList();
  assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  assertEquals(3,edges.size());
  assertEquals(e3,edges.get(0));
  assertEquals(e2,edges.get(1));
  assertEquals(e1,edges.get(2));
  traversal=(DefaultGraphTraversal<Vertex,Edge>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").outE().order().by("String_Node_Str",Order.incr);
  assertEquals(4,traversal.getSteps().size());
  edges=traversal.toList();
  assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  assertEquals(3,edges.size());
  assertEquals(e1,edges.get(0));
  assertEquals(e2,edges.get(1));
  assertEquals(e3,edges.get(2));
  traversal=(DefaultGraphTraversal<Vertex,Edge>)this.sqlgGraph.traversal().V().hasLabel("String_Node_Str").outE().order().by("String_Node_Str");
  assertEquals(4,traversal.getSteps().size());
  edges=traversal.toList();
  assertEquals(1,traversal.getSteps().size());
  assertStep(traversal.getSteps().get(0),true,false,false,false);
  assertEquals(3,edges.size());
  assertEquals(e1,edges.get(0));
  assertEquals(e2,edges.get(1));
  assertEquals(e3,edges.get(2));
}
Program: 166904
Project: 166904
Buggy source:
public Optional<VertexLabel> getVertexLabel(String vertexLabelName){
  Preconditions.checkArgument(!vertexLabelName.startsWith(VERTEX_PREFIX),"String_Node_Str",Topology.VERTEX_PREFIX);
  if (this.topology.isSqlWriteLockHeldByCurrentThread() && this.uncommittedRemovedVertexLabels.contains(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName)) {
    return Optional.empty();
  }
  VertexLabel result=this.vertexLabels.get(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName);
  if (result == null && this.topology.isSqlWriteLockHeldByCurrentThread()) {
    result=this.uncommittedVertexLabels.get(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName);
  }
  return Optional.ofNullable(result);
}

Fixed version (ground truth):
public Optional<VertexLabel> getVertexLabel(String vertexLabelName){
  Preconditions.checkArgument(!vertexLabelName.startsWith(VERTEX_PREFIX),"String_Node_Str",Topology.VERTEX_PREFIX);
  if (this.topology.isSqlWriteLockHeldByCurrentThread() && this.uncommittedRemovedVertexLabels.contains(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName)) {
    return Optional.empty();
  }
  VertexLabel result=null;
  if (this.topology.isSqlWriteLockHeldByCurrentThread()) {
    result=this.uncommittedVertexLabels.get(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName);
  }
  if (result == null) {
    result=this.vertexLabels.get(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName);
  }
  return Optional.ofNullable(result);
}
Program: 166907
Project: 166907
Buggy source:
@Test public void testEscapedValuesWithinQuery(){
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  assertEquals(vals.length,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",P.within(vals)).count().next().longValue());
}

Fixed version (ground truth):
@Test public void testEscapedValuesWithinQuery(){
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  assertEquals(vals.length,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",P.within(vals)).count().next().longValue());
}
Program: 166908
Project: 166908
Buggy source:
@Test public void testEscapedValuesSingleQuery(){
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  for (  String s : vals) {
    assertEquals(s,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",s).count().next().longValue());
    assertEquals(s,s,this.sqlgGraph.traversal().V().has("String_Node_Str",s).values("String_Node_Str").next());
  }
}

Fixed version (ground truth):
@Test public void testEscapedValuesSingleQuery(){
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  for (  String s : vals) {
    assertEquals(s,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",s).count().next().longValue());
    assertEquals(s,s,this.sqlgGraph.traversal().V().has("String_Node_Str",s).values("String_Node_Str").next());
  }
}
Program: 166909
Project: 166909
Buggy source:
@Test public void testEscapedValuesSingleQueryBatch(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsBatchMode());
  this.sqlgGraph.tx().normalBatchModeOn();
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  for (  String s : vals) {
    assertEquals(s,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",s).count().next().longValue());
    assertEquals(s,s,this.sqlgGraph.traversal().V().has("String_Node_Str",s).values("String_Node_Str").next());
  }
}

Fixed version (ground truth):
@Test public void testEscapedValuesSingleQueryBatch(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsBatchMode());
  this.sqlgGraph.tx().normalBatchModeOn();
  String[] vals=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String s : vals) {
    this.sqlgGraph.addVertex("String_Node_Str").property("String_Node_Str",s);
  }
  this.sqlgGraph.tx().commit();
  for (  String s : vals) {
    assertEquals(s,1L,this.sqlgGraph.traversal().V().has("String_Node_Str",s).count().next().longValue());
    assertEquals(s,s,this.sqlgGraph.traversal().V().has("String_Node_Str",s).values("String_Node_Str").next());
  }
}
Program: 166911
Project: 166911
Buggy source:
@Override public boolean supportsTransactionalSchema(){
  return false;
}

Fixed version (ground truth):
@Override public boolean supportsTransactionalSchema(){
  return true;
}
Program: 166912
Project: 166912
Buggy source:
public EdgeLabel ensureEdgeLabelExist(final String edgeLabelName,final VertexLabel outVertexLabel,final VertexLabel inVertexLabel,Map<String,PropertyType> columns){
  Objects.requireNonNull(edgeLabelName,"String_Node_Str");
  Objects.requireNonNull(outVertexLabel,"String_Node_Str");
  Objects.requireNonNull(inVertexLabel,"String_Node_Str");
  EdgeLabel edgeLabel;
  Optional<EdgeLabel> edgeLabelOptional=this.getEdgeLabel(edgeLabelName);
  if (!edgeLabelOptional.isPresent()) {
    this.topology.lock();
    edgeLabelOptional=this.getEdgeLabel(edgeLabelName);
    if (!edgeLabelOptional.isPresent()) {
      edgeLabel=this.createEdgeLabel(edgeLabelName,outVertexLabel,inVertexLabel,columns);
      this.uncommittedOutEdgeLabels.put(this.name + "String_Node_Str" + EDGE_PREFIX+ edgeLabelName,edgeLabel);
      this.getTopology().fire(edgeLabel,"String_Node_Str",TopologyChangeAction.CREATE);
    }
 else {
      edgeLabel=internalEnsureEdgeTableExists(edgeLabelOptional.get(),outVertexLabel,inVertexLabel,columns);
    }
  }
 else {
    edgeLabel=internalEnsureEdgeTableExists(edgeLabelOptional.get(),outVertexLabel,inVertexLabel,columns);
  }
  return edgeLabel;
}

Fixed version (ground truth):
public EdgeLabel ensureEdgeLabelExist(final String edgeLabelName,final VertexLabel outVertexLabel,final VertexLabel inVertexLabel,Map<String,PropertyType> columns){
  Objects.requireNonNull(edgeLabelName,"String_Node_Str");
  Objects.requireNonNull(outVertexLabel,"String_Node_Str");
  Objects.requireNonNull(inVertexLabel,"String_Node_Str");
  EdgeLabel edgeLabel;
  Optional<EdgeLabel> edgeLabelOptional=this.getEdgeLabel(edgeLabelName);
  if (!edgeLabelOptional.isPresent()) {
    this.topology.lock();
    edgeLabelOptional=this.getEdgeLabel(edgeLabelName);
    if (!edgeLabelOptional.isPresent()) {
      edgeLabel=this.createEdgeLabel(edgeLabelName,outVertexLabel,inVertexLabel,columns);
      this.uncommittedRemovedEdgeLabels.remove(this.name + "String_Node_Str" + EDGE_PREFIX+ edgeLabelName);
      this.uncommittedOutEdgeLabels.put(this.name + "String_Node_Str" + EDGE_PREFIX+ edgeLabelName,edgeLabel);
      this.getTopology().fire(edgeLabel,"String_Node_Str",TopologyChangeAction.CREATE);
    }
 else {
      edgeLabel=internalEnsureEdgeTableExists(edgeLabelOptional.get(),outVertexLabel,inVertexLabel,columns);
    }
  }
 else {
    edgeLabel=internalEnsureEdgeTableExists(edgeLabelOptional.get(),outVertexLabel,inVertexLabel,columns);
  }
  return edgeLabel;
}
Program: 166913
Project: 166913
Buggy source:
private VertexLabel createVertexLabel(String vertexLabelName,Map<String,PropertyType> columns){
  Preconditions.checkState(!this.isSqlgSchema(),"String_Node_Str",SQLG_SCHEMA);
  Preconditions.checkArgument(!vertexLabelName.startsWith(VERTEX_PREFIX),"String_Node_Str" + VERTEX_PREFIX);
  VertexLabel vertexLabel=VertexLabel.createVertexLabel(this.sqlgGraph,this,vertexLabelName,columns);
  this.uncommittedVertexLabels.put(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName,vertexLabel);
  this.getTopology().fire(vertexLabel,"String_Node_Str",TopologyChangeAction.CREATE);
  return vertexLabel;
}

Fixed version (ground truth):
private VertexLabel createVertexLabel(String vertexLabelName,Map<String,PropertyType> columns){
  Preconditions.checkState(!this.isSqlgSchema(),"String_Node_Str",SQLG_SCHEMA);
  Preconditions.checkArgument(!vertexLabelName.startsWith(VERTEX_PREFIX),"String_Node_Str" + VERTEX_PREFIX);
  this.uncommittedRemovedVertexLabels.remove(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName);
  VertexLabel vertexLabel=VertexLabel.createVertexLabel(this.sqlgGraph,this,vertexLabelName,columns);
  this.uncommittedVertexLabels.put(this.name + "String_Node_Str" + VERTEX_PREFIX+ vertexLabelName,vertexLabel);
  this.getTopology().fire(vertexLabel,"String_Node_Str",TopologyChangeAction.CREATE);
  return vertexLabel;
}
Program: 166914
Project: 166914
Buggy source:
/** 
 * Ensures that the schema exists.
 * @param schemaName The schema to create if it does not exist.
 */
public Schema ensureSchemaExist(final String schemaName){
  Optional<Schema> schemaOptional=this.getSchema(schemaName);
  Schema schema;
  if (!schemaOptional.isPresent()) {
    this.lock();
    schemaOptional=this.getSchema(schemaName);
    if (!schemaOptional.isPresent()) {
      schema=Schema.createSchema(this.sqlgGraph,this,schemaName);
      this.uncommittedSchemas.put(schemaName,schema);
      fire(schema,"String_Node_Str",TopologyChangeAction.CREATE);
      return schema;
    }
 else {
      return schemaOptional.get();
    }
  }
 else {
    return schemaOptional.get();
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the schema exists.
 * @param schemaName The schema to create if it does not exist.
 */
public Schema ensureSchemaExist(final String schemaName){
  Optional<Schema> schemaOptional=this.getSchema(schemaName);
  Schema schema;
  if (!schemaOptional.isPresent()) {
    this.lock();
    schemaOptional=this.getSchema(schemaName);
    if (!schemaOptional.isPresent()) {
      schema=Schema.createSchema(this.sqlgGraph,this,schemaName);
      this.uncommittedRemovedSchemas.remove(schemaName);
      this.uncommittedSchemas.put(schemaName,schema);
      fire(schema,"String_Node_Str",TopologyChangeAction.CREATE);
      return schema;
    }
 else {
      return schemaOptional.get();
    }
  }
 else {
    return schemaOptional.get();
  }
}