nus-yam/ex-repair huggingface dataset:
Program: 166915
Project: 166915
Buggy source:
/** 
 * Global lock on the topology. For distributed graph (multiple jvm) this happens on the db via a lock sql statement.
 */
void lock(){
  if (!isWriteLockHeldByCurrentThread()) {
    try {
      this.sqlgGraph.tx().readWrite();
      if (!this.reentrantReadWriteLock.writeLock().tryLock(LOCK_TIMEOUT,TimeUnit.SECONDS)) {
        throw new RuntimeException("String_Node_Str");
      }
      if (this.distributed) {
        ((SqlSchemaChangeDialect)this.sqlgGraph.getSqlDialect()).lock(this.sqlgGraph);
        if (!this.notificationTimestamps.isEmpty()) {
          LocalDateTime timestamp=this.notificationTimestamps.last();
          List<Vertex> logs=this.sqlgGraph.topology().V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_LOG).has(SQLG_SCHEMA_LOG_TIMESTAMP,P.gt(timestamp)).toList();
          for (          Vertex logVertex : logs) {
            ObjectNode log=logVertex.value("String_Node_Str");
            fromNotifyJson(timestamp,log);
          }
        }
      }
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Global lock on the topology. For distributed graph (multiple jvm) this happens on the db via a lock sql statement.
 */
void lock(){
  if (!isWriteLockHeldByCurrentThread()) {
    try {
      this.sqlgGraph.tx().readWrite();
      if (!this.reentrantReadWriteLock.writeLock().tryLock(LOCK_TIMEOUT,TimeUnit.SECONDS)) {
        throw new RuntimeException("String_Node_Str");
      }
      if (this.distributed) {
        ((SqlSchemaChangeDialect)this.sqlgGraph.getSqlDialect()).lock(this.sqlgGraph);
        if (!this.notificationTimestamps.isEmpty()) {
          LocalDateTime timestamp=this.notificationTimestamps.last();
          List<Vertex> logs=this.sqlgGraph.topology().V().hasLabel(SQLG_SCHEMA + "String_Node_Str" + SQLG_SCHEMA_LOG).has(SQLG_SCHEMA_LOG_TIMESTAMP,P.gt(timestamp)).toList();
          for (          Vertex logVertex : logs) {
            int pid=logVertex.value("String_Node_Str");
            LocalDateTime timestamp2=logVertex.value("String_Node_Str");
            if (!ownPids.contains(new ImmutablePair<>(pid,timestamp2))) {
              ObjectNode log=logVertex.value("String_Node_Str");
              fromNotifyJson(timestamp,log);
            }
          }
        }
      }
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 166916
Project: 166916
Buggy source:
private void beforeCommit(){
  Optional<JsonNode> jsonNodeOptional=this.toNotifyJson();
  if (jsonNodeOptional.isPresent() && this.distributed) {
    SqlSchemaChangeDialect sqlSchemaChangeDialect=(SqlSchemaChangeDialect)this.sqlgGraph.getSqlDialect();
    LocalDateTime timestamp=LocalDateTime.now();
    int pid=sqlSchemaChangeDialect.notifyChange(sqlgGraph,timestamp,jsonNodeOptional.get());
    this.ownPids.add(pid);
  }
}

Fixed version (ground truth):
private void beforeCommit(){
  Optional<JsonNode> jsonNodeOptional=this.toNotifyJson();
  if (jsonNodeOptional.isPresent() && this.distributed) {
    SqlSchemaChangeDialect sqlSchemaChangeDialect=(SqlSchemaChangeDialect)this.sqlgGraph.getSqlDialect();
    LocalDateTime timestamp=LocalDateTime.now();
    int pid=sqlSchemaChangeDialect.notifyChange(sqlgGraph,timestamp,jsonNodeOptional.get());
    this.ownPids.add(new ImmutablePair<>(pid,timestamp));
  }
}
Program: 166920
Project: 166920
Buggy source:
@Test public void testDateTimeArrayProperties(){
  Vertex v=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  LocalDateTime ldt=LocalDateTime.now();
  v.property("String_Node_Str",new LocalDateTime[]{ldt});
  v.property("String_Node_Str",new LocalDate[]{ldt.toLocalDate()});
  LocalTime lt=ldt.toLocalTime().truncatedTo(ChronoUnit.SECONDS);
  v.property("String_Node_Str",new LocalTime[]{lt});
  ZonedDateTime zdt=ZonedDateTime.now();
  v.property("String_Node_Str",new ZonedDateTime[]{zdt});
  Period p=Period.ofDays(3);
  v.property("String_Node_Str",new Period[]{p});
  Duration d=Duration.ofHours(12);
  v.property("String_Node_Str",new Duration[]{d});
  this.sqlgGraph.tx().commit();
  assertObjectArrayProperty(v,"String_Node_Str",ldt);
  assertObjectArrayProperty(v,"String_Node_Str",ldt.toLocalDate());
  assertObjectArrayProperty(v,"String_Node_Str",lt);
  assertObjectArrayProperty(v,"String_Node_Str",zdt);
  assertObjectArrayProperty(v,"String_Node_Str",p);
  assertObjectArrayProperty(v,"String_Node_Str",d);
}

Fixed version (ground truth):
@Test public void testDateTimeArrayProperties(){
  Vertex v=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  LocalDateTime ldt=LocalDateTime.now();
  v.property("String_Node_Str",new LocalDateTime[]{ldt});
  v.property("String_Node_Str",new LocalDate[]{ldt.toLocalDate()});
  LocalTime lt=ldt.toLocalTime().truncatedTo(ChronoUnit.SECONDS);
  v.property("String_Node_Str",new LocalTime[]{lt});
  ZonedDateTime zdt=ZonedDateTime.now();
  v.property("String_Node_Str",new ZonedDateTime[]{zdt});
  ZonedDateTime zdt2=ZonedDateTime.of(LocalDateTime.now(),ZoneId.of("String_Node_Str"));
  v.property("String_Node_Str",new ZonedDateTime[]{zdt2});
  Period p=Period.ofDays(3);
  v.property("String_Node_Str",new Period[]{p});
  Duration d=Duration.ofHours(12);
  v.property("String_Node_Str",new Duration[]{d});
  this.sqlgGraph.tx().commit();
  assertObjectArrayProperty(v,"String_Node_Str",ldt);
  assertObjectArrayProperty(v,"String_Node_Str",ldt.toLocalDate());
  assertObjectArrayProperty(v,"String_Node_Str",lt);
  assertObjectArrayProperty(v,"String_Node_Str",zdt);
  assertObjectArrayProperty(v,"String_Node_Str",zdt2);
  assertObjectArrayProperty(v,"String_Node_Str",p);
  assertObjectArrayProperty(v,"String_Node_Str",d);
}
Program: 166921
Project: 166921
Buggy source:
@Test public void testSetBytePrimitiveArrayProperty(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsByteArrayValues());
  Vertex marko=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  marko.property("String_Node_Str",new byte[]{(byte)1,(byte)2});
  this.sqlgGraph.tx().commit();
  Assert.assertArrayEquals(new byte[]{(byte)1,(byte)2},(byte[])marko.property("String_Node_Str").value());
}

Fixed version (ground truth):
@Test public void testSetBytePrimitiveArrayProperty(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsByteArrayValues());
  Vertex marko=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  marko.property("String_Node_Str",new byte[]{(byte)1,(byte)2});
  this.sqlgGraph.tx().commit();
  Assert.assertArrayEquals(new byte[]{(byte)1,(byte)2},(byte[])marko.property("String_Node_Str").value());
  marko.property("String_Node_Str","String_Node_Str".getBytes(StandardCharsets.UTF_8));
  this.sqlgGraph.tx().commit();
  Assert.assertEquals("String_Node_Str",new String((byte[])marko.property("String_Node_Str").value(),StandardCharsets.UTF_8));
}
Program: 166922
Project: 166922
Buggy source:
@Test public void testSetByteArrayProperty(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsByteArrayValues());
  Vertex marko=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  marko.property("String_Node_Str",new Byte[]{(byte)1,(byte)2});
  this.sqlgGraph.tx().commit();
  Assert.assertArrayEquals(new Byte[]{(byte)1,(byte)2},(Byte[])marko.property("String_Node_Str").value());
}

Fixed version (ground truth):
@Test public void testSetByteArrayProperty(){
  Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsByteArrayValues());
  Vertex marko=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  marko.property("String_Node_Str",new Byte[]{(byte)1,(byte)2});
  this.sqlgGraph.tx().commit();
  Assert.assertArrayEquals(new Byte[]{(byte)1,(byte)2},(Byte[])marko.property("String_Node_Str").value());
  marko.property("String_Node_Str","String_Node_Str".getBytes(StandardCharsets.UTF_8));
  this.sqlgGraph.tx().commit();
  Assert.assertEquals("String_Node_Str",new String((byte[])marko.property("String_Node_Str").value(),StandardCharsets.UTF_8));
}
Program: 166923
Project: 166923
Buggy source:
@Test public void testZonedDateTime() throws InterruptedException {
  ZonedDateTime zonedDateTime=ZonedDateTime.now();
  this.sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NORMAL);
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str",zonedDateTime);
  this.sqlgGraph.tx().commit();
  Assert.assertEquals(zonedDateTime,this.sqlgGraph.traversal().V(a1).values("String_Node_Str").next());
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    Assert.assertEquals(zonedDateTime,this.sqlgGraph1.traversal().V(a1).values("String_Node_Str").next());
  }
}

Fixed version (ground truth):
@Test public void testZonedDateTime() throws InterruptedException {
  ZonedDateTime zonedDateTime=ZonedDateTime.now();
  ZonedDateTime zdt2=ZonedDateTime.of(LocalDateTime.now(),ZoneId.of("String_Node_Str"));
  ZonedDateTime zdt2Fixed=ZonedDateTime.of(zdt2.toLocalDateTime(),ZoneId.of("String_Node_Str"));
  this.sqlgGraph.tx().batchMode(BatchManager.BatchModeType.NORMAL);
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str",zonedDateTime,"String_Node_Str",zdt2,"String_Node_Str",zdt2Fixed);
  this.sqlgGraph.tx().commit();
  Assert.assertEquals(zonedDateTime,this.sqlgGraph.traversal().V(a1).values("String_Node_Str").next());
  Assert.assertEquals(zdt2Fixed,this.sqlgGraph.traversal().V(a1).values("String_Node_Str").next());
  Assert.assertEquals(zdt2Fixed,this.sqlgGraph.traversal().V(a1).values("String_Node_Str").next());
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    Assert.assertEquals(zonedDateTime,this.sqlgGraph1.traversal().V(a1).values("String_Node_Str").next());
    Assert.assertEquals(zdt2Fixed,this.sqlgGraph1.traversal().V(a1).values("String_Node_Str").next());
    Assert.assertEquals(zdt2Fixed,this.sqlgGraph1.traversal().V(a1).values("String_Node_Str").next());
  }
}
Program: 166924
Project: 166924
Buggy source:
@Test public void testBatchArraybyte() throws InterruptedException {
  this.sqlgGraph.tx().normalBatchModeOn();
  Vertex god=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str",new byte[]{1,3});
  this.sqlgGraph.tx().commit();
  testBatchArraybyte_assert(this.sqlgGraph,god);
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    testBatchArraybyte_assert(this.sqlgGraph1,god);
  }
}

Fixed version (ground truth):
@Test public void testBatchArraybyte() throws InterruptedException {
  this.sqlgGraph.tx().normalBatchModeOn();
  Vertex god=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str",new byte[]{1,3});
  this.sqlgGraph.tx().commit();
  testBatchArraybyte_assert(this.sqlgGraph,god);
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    testBatchArraybyte_assert(this.sqlgGraph1,god);
  }
  this.sqlgGraph.tx().normalBatchModeOn();
  god.property("String_Node_Str","String_Node_Str".getBytes(StandardCharsets.UTF_8));
  this.sqlgGraph.tx().commit();
  testBatchArraybyteSpecial_assert(this.sqlgGraph,god);
  if (this.sqlgGraph1 != null) {
    Thread.sleep(SLEEP_TIME);
    testBatchArraybyteSpecial_assert(this.sqlgGraph1,god);
  }
}
Program: 166930
Project: 166930
Buggy source:
private <TP>void assertProperty(Vertex v,String property,TP expected){
  Assert.assertEquals(expected,v.property(property).value());
  Assert.assertEquals(expected,this.sqlgGraph.traversal().V(v).values(property).next());
}

Fixed version (ground truth):
private static <TP>void assertProperty(SqlgGraph g,Edge e,String property,TP expected){
  Assert.assertEquals(expected,e.property(property).value());
  Assert.assertEquals(expected,g.traversal().E(e).values(property).next());
}
Program: 166931
Project: 166931
Buggy source:
public static IndexType fromNotifyJson(JsonNode node){
  IndexType it=new IndexType(node.get("String_Node_Str").asText());
  Iterator<String> keys=node.fieldNames();
  while (keys.hasNext()) {
    String k=keys.next();
    if (!"String_Node_Str".equals(k)) {
      it.getProperties().put(k,node.get(k).asText());
    }
  }
  return it;
}

Fixed version (ground truth):
public static IndexType fromNotifyJson(JsonNode node){
  if (node.isValueNode()) {
    String s=node.asText();
    if ("String_Node_Str".equalsIgnoreCase(s)) {
      return UNIQUE;
    }
 else     if ("String_Node_Str".equalsIgnoreCase(s)) {
      return NON_UNIQUE;
    }
  }
  IndexType it=new IndexType(node.get("String_Node_Str").asText());
  Iterator<String> keys=node.fieldNames();
  while (keys.hasNext()) {
    String k=keys.next();
    if (!"String_Node_Str".equals(k)) {
      it.getProperties().put(k,node.get(k).asText());
    }
  }
  return it;
}
Program: 166933
Project: 166933
Buggy source:
private Array createArrayOf(Connection conn,PropertyType propertyType,Object[] data){
  try {
switch (propertyType) {
case STRING_ARRAY:
case long_ARRAY:
case LONG_ARRAY:
case int_ARRAY:
case INTEGER_ARRAY:
case short_ARRAY:
case SHORT_ARRAY:
case float_ARRAY:
case FLOAT_ARRAY:
case double_ARRAY:
case DOUBLE_ARRAY:
case boolean_ARRAY:
case BOOLEAN_ARRAY:
case LOCALDATETIME_ARRAY:
case LOCALDATE_ARRAY:
case LOCALTIME_ARRAY:
case ZONEDDATETIME_ARRAY:
case JSON_ARRAY:
      return conn.createArrayOf(getArrayDriverType(propertyType),data);
default :
    throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
private Array createArrayOf(Connection conn,PropertyType propertyType,Object[] data){
  try {
switch (propertyType) {
case LOCALTIME_ARRAY:
      if (data != null) {
        int a=0;
        for (        Object o : data) {
          data[a++]=shiftDST(((Time)o).toLocalTime());
        }
      }
case STRING_ARRAY:
case long_ARRAY:
case LONG_ARRAY:
case int_ARRAY:
case INTEGER_ARRAY:
case short_ARRAY:
case SHORT_ARRAY:
case float_ARRAY:
case FLOAT_ARRAY:
case double_ARRAY:
case DOUBLE_ARRAY:
case boolean_ARRAY:
case BOOLEAN_ARRAY:
case LOCALDATETIME_ARRAY:
case LOCALDATE_ARRAY:
case ZONEDDATETIME_ARRAY:
case JSON_ARRAY:
    return conn.createArrayOf(getArrayDriverType(propertyType),data);
default :
  throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}
Program: 166935
Project: 166935
Buggy source:
default String sqlgSqlgSchemaCreationScript(){
  return "String_Node_Str";
}

Fixed version (ground truth):
default String sqlgSqlgSchemaCreationScript(){
  return "String_Node_Str" + this.maybeWrapInQoutes("String_Node_Str");
}
Program: 166936
Project: 166936
Buggy source:
private boolean existGuiSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    if (this.sqlDialect.supportSchemas()) {
      DatabaseMetaData metadata=conn.getMetaData();
      ResultSet schemaRs=metadata.getSchemas(null,Schema.GLOBAL_UNIQUE_INDEX_SCHEMA);
      return schemaRs.next();
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private boolean existGuiSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    if (this.sqlDialect.supportSchemas()) {
      DatabaseMetaData metadata=conn.getMetaData();
      return this.sqlDialect.schemaExists(metadata,null,Schema.GLOBAL_UNIQUE_INDEX_SCHEMA);
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 166937
Project: 166937
Buggy source:
private boolean existSqlgSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    if (this.sqlDialect.supportSchemas()) {
      DatabaseMetaData metadata=conn.getMetaData();
      ResultSet schemaRs=metadata.getSchemas(null,SQLG_SCHEMA);
      return schemaRs.next();
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private boolean existSqlgSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    if (this.sqlDialect.supportSchemas()) {
      DatabaseMetaData metadata=conn.getMetaData();
      return this.sqlDialect.schemaExists(metadata,null,SQLG_SCHEMA);
    }
 else {
      throw new IllegalStateException("String_Node_Str");
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 166938
Project: 166938
Buggy source:
private void createGuiSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try (Statement statement=conn.createStatement()){
    statement.execute("String_Node_Str" + Schema.GLOBAL_UNIQUE_INDEX_SCHEMA + "String_Node_Str");
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private void createGuiSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try (Statement statement=conn.createStatement()){
    statement.execute("String_Node_Str" + this.sqlDialect.maybeWrapInQoutes(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA) + "String_Node_Str");
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 166940
Project: 166940
Buggy source:
private Array createArrayOf(Connection conn,PropertyType propertyType,Object[] data){
  try {
switch (propertyType) {
case STRING_ARRAY:
case long_ARRAY:
case LONG_ARRAY:
case int_ARRAY:
case INTEGER_ARRAY:
case short_ARRAY:
case SHORT_ARRAY:
case float_ARRAY:
case FLOAT_ARRAY:
case double_ARRAY:
case DOUBLE_ARRAY:
case boolean_ARRAY:
case BOOLEAN_ARRAY:
case LOCALDATETIME_ARRAY:
case LOCALDATE_ARRAY:
case LOCALTIME_ARRAY:
case ZONEDDATETIME_ARRAY:
case JSON_ARRAY:
      return conn.createArrayOf(getArrayDriverType(propertyType),data);
default :
    throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
private Array createArrayOf(Connection conn,PropertyType propertyType,Object[] data){
  try {
switch (propertyType) {
case LOCALTIME_ARRAY:
      if (data != null) {
        int a=0;
        for (        Object o : data) {
          data[a++]=shiftDST(((Time)o).toLocalTime());
        }
      }
case STRING_ARRAY:
case long_ARRAY:
case LONG_ARRAY:
case int_ARRAY:
case INTEGER_ARRAY:
case short_ARRAY:
case SHORT_ARRAY:
case float_ARRAY:
case FLOAT_ARRAY:
case double_ARRAY:
case DOUBLE_ARRAY:
case boolean_ARRAY:
case BOOLEAN_ARRAY:
case LOCALDATETIME_ARRAY:
case LOCALDATE_ARRAY:
case ZONEDDATETIME_ARRAY:
case JSON_ARRAY:
    return conn.createArrayOf(getArrayDriverType(propertyType),data);
default :
  throw new IllegalStateException("String_Node_Str" + propertyType.name());
}
}
 catch (SQLException e) {
throw new RuntimeException(e);
}
}
Program: 166943
Project: 166943
Buggy source:
protected abstract void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep);

Fixed version (ground truth):
protected abstract void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep,int pathCount);
Program: 166944
Project: 166944
Buggy source:
private static void collectOrderGlobalSteps(Step step,ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep){
  if (step instanceof OrderGlobalStep && isElementValueComparator((OrderGlobalStep)step)) {
    iterator.remove();
    traversal.removeStep(step);
    replacedStep.getComparators().addAll(((OrderGlobalStep)step).getComparators());
    if (iterator.hasNext()) {
      step=iterator.next();
      if (!collectRangeGlobalStep(step,iterator,traversal,replacedStep,false)) {
        iterator.previous();
      }
    }
  }
 else   if (collectRangeGlobalStep(step,iterator,traversal,replacedStep,false)) {
  }
 else {
    collectSelectOrderGlobalSteps(iterator,traversal,replacedStep);
  }
}

Fixed version (ground truth):
private static void collectOrderGlobalSteps(Step step,ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep,int pathCount){
  if (step instanceof OrderGlobalStep && isElementValueComparator((OrderGlobalStep)step)) {
    iterator.remove();
    traversal.removeStep(step);
    replacedStep.getComparators().addAll(((OrderGlobalStep)step).getComparators());
    for (    Object l : step.getLabels()) {
      replacedStep.addLabel(pathCount + BaseSqlgStrategy.PATH_LABEL_SUFFIX + l);
    }
    if (iterator.hasNext()) {
      step=iterator.next();
      if (!collectRangeGlobalStep(step,iterator,traversal,replacedStep,false,pathCount)) {
        iterator.previous();
      }
    }
  }
 else   if (collectRangeGlobalStep(step,iterator,traversal,replacedStep,false,pathCount)) {
  }
 else {
    collectSelectOrderGlobalSteps(iterator,traversal,replacedStep,pathCount);
  }
}
Program: 166945
Project: 166945
Buggy source:
@Override protected void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep){
  Preconditions.checkArgument(lastReplacedStep != null);
  sqlgStep.parseForStrategy();
  if (!sqlgStep.isForMultipleQueries()) {
    collectOrderGlobalSteps(step,stepIterator,traversal,lastReplacedStep);
  }
 else {
    if (stepIterator.hasNext()) {
      step=stepIterator.next();
      if (!collectRangeGlobalStep(step,stepIterator,traversal,lastReplacedStep,true)) {
        stepIterator.previous();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep,int pathCount){
  Preconditions.checkArgument(lastReplacedStep != null);
  sqlgStep.parseForStrategy();
  if (!sqlgStep.isForMultipleQueries()) {
    collectOrderGlobalSteps(step,stepIterator,traversal,lastReplacedStep,pathCount);
  }
 else {
    if (stepIterator.hasNext()) {
      step=stepIterator.next();
      if (!collectRangeGlobalStep(step,stepIterator,traversal,lastReplacedStep,true,pathCount)) {
        stepIterator.previous();
      }
    }
  }
}
Program: 166946
Project: 166946
Buggy source:
/** 
 * collect a range global step
 * @param step the current step to collect
 * @param iterator the step iterator
 * @param traversal the traversal of all steps
 * @param replacedStep the current replaced step collecting the info
 * @param multiple are we in a multiple label query?
 * @return true if we impacted the iterator by removing the current step, false otherwise
 */
private static boolean collectRangeGlobalStep(Step step,ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep,boolean multiple){
  if (step instanceof RangeGlobalStep<?>) {
    RangeGlobalStep<?> rgs=(RangeGlobalStep<?>)step;
    if (!multiple || rgs.getLowRange() == 0) {
      long high=rgs.getHighRange();
      if (multiple) {
        high+=1;
      }
      replacedStep.setRange(Range.between(rgs.getLowRange(),high));
      if (!multiple) {
        iterator.remove();
        traversal.removeStep(step);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * collect a range global step
 * @param step the current step to collect
 * @param iterator the step iterator
 * @param traversal the traversal of all steps
 * @param replacedStep the current replaced step collecting the info
 * @param multiple are we in a multiple label query?
 * @return true if we impacted the iterator by removing the current step, false otherwise
 */
private static boolean collectRangeGlobalStep(Step step,ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep,boolean multiple,int pathCount){
  if (step instanceof RangeGlobalStep<?>) {
    RangeGlobalStep<?> rgs=(RangeGlobalStep<?>)step;
    if (!multiple || rgs.getLowRange() == 0) {
      long high=rgs.getHighRange();
      if (multiple) {
        high+=1;
      }
      replacedStep.setRange(Range.between(rgs.getLowRange(),high));
      for (      Object l : step.getLabels()) {
        replacedStep.addLabel(pathCount + BaseSqlgStrategy.PATH_LABEL_SUFFIX + l);
      }
      if (!multiple) {
        iterator.remove();
        traversal.removeStep(step);
        return true;
      }
    }
  }
  return false;
}
Program: 166947
Project: 166947
Buggy source:
private static void collectSelectOrderGlobalSteps(ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep){
  while (iterator.hasNext()) {
    Step<?,?> currentStep=iterator.next();
    if (currentStep instanceof OrderGlobalStep && (isElementValueComparator((OrderGlobalStep)currentStep) || isTraversalComparatorWithSelectOneStep((OrderGlobalStep)currentStep))) {
      iterator.remove();
      traversal.removeStep(currentStep);
      replacedStep.getComparators().addAll(((OrderGlobalStep)currentStep).getComparators());
    }
 else     if (currentStep instanceof IdentityStep) {
    }
 else     if (collectRangeGlobalStep(currentStep,iterator,traversal,replacedStep,false)) {
    }
 else {
      iterator.previous();
      break;
    }
  }
}

Fixed version (ground truth):
private static void collectSelectOrderGlobalSteps(ListIterator<Step> iterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> replacedStep,int pathCount){
  while (iterator.hasNext()) {
    Step<?,?> currentStep=iterator.next();
    if (currentStep instanceof OrderGlobalStep && (isElementValueComparator((OrderGlobalStep)currentStep) || isTraversalComparatorWithSelectOneStep((OrderGlobalStep)currentStep))) {
      iterator.remove();
      traversal.removeStep(currentStep);
      replacedStep.getComparators().addAll(((OrderGlobalStep)currentStep).getComparators());
      for (      Object l : currentStep.getLabels()) {
        replacedStep.addLabel(pathCount + BaseSqlgStrategy.PATH_LABEL_SUFFIX + l);
      }
    }
 else     if (currentStep instanceof IdentityStep) {
    }
 else     if (collectRangeGlobalStep(currentStep,iterator,traversal,replacedStep,false,pathCount)) {
    }
 else {
      iterator.previous();
      break;
    }
  }
}
Program: 166948
Project: 166948
Buggy source:
@Override protected void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep){
  Preconditions.checkArgument(lastReplacedStep != null);
  replaceOrderGlobalSteps(step,stepIterator,traversal,lastReplacedStep);
}

Fixed version (ground truth):
@Override protected void doLastEntry(Step step,ListIterator<Step> stepIterator,Traversal.Admin<?,?> traversal,ReplacedStep<?,?> lastReplacedStep,SqlgStep sqlgStep,int pathCount){
  Preconditions.checkArgument(lastReplacedStep != null);
  replaceOrderGlobalSteps(step,stepIterator,traversal,lastReplacedStep);
}
Program: 166951
Project: 166951
Buggy source:
@Test public void test(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a11=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex c1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  a1.addEdge("String_Node_Str",b1);
  b1.addEdge("String_Node_Str",c1);
  this.sqlgGraph.tx().commit();
  List<Path> paths=gt.V(a1).local(out().out()).path().toList();
  for (  Path path : paths) {
    System.out.println(path);
  }
}

Fixed version (ground truth):
@Test public void test(){
  Vertex a1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex a11=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex b1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  Vertex c1=this.sqlgGraph.addVertex(T.label,"String_Node_Str","String_Node_Str","String_Node_Str");
  a1.addEdge("String_Node_Str",b1);
  b1.addEdge("String_Node_Str",c1);
  this.sqlgGraph.tx().commit();
  DefaultGraphTraversal<Vertex,Path> traversal=(DefaultGraphTraversal)gt.V(a1).local(out().out()).path();
  Assert.assertEquals(3,traversal.getSteps().size());
  Assert.assertTrue(traversal.getSteps().get(1) instanceof LocalStep);
  LocalStep<?,?> localStep=(LocalStep)traversal.getSteps().get(1);
  Assert.assertEquals(1,localStep.getLocalChildren().size());
  Traversal.Admin<?,?> traversal1=localStep.getLocalChildren().get(0);
  Assert.assertEquals(2,traversal1.getSteps().size());
  List<Path> paths=traversal.toList();
  Assert.assertEquals(1,paths.size());
  Assert.assertEquals(3,traversal.getSteps().size());
  Assert.assertTrue(traversal.getSteps().get(1) instanceof LocalStep);
  localStep=(LocalStep)traversal.getSteps().get(1);
  Assert.assertEquals(1,localStep.getLocalChildren().size());
  traversal1=localStep.getLocalChildren().get(0);
  Assert.assertEquals(1,traversal1.getSteps().size());
}
Program: 166952
Project: 166952
Buggy source:
private String printLabeledOuterFromClause(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  sql+="String_Node_Str" + counter + "String_Node_Str"+ this.labeledMappedAliasIdForOuterFromClause(columnNameAliasMapCopy)+ "String_Node_Str";
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  if (!propertyTypeMap.isEmpty()) {
    sql+="String_Node_Str";
  }
  sql=this.printLabeledOuterFromClauseFor(sql,counter,columnNameAliasMapCopy);
  if (this.getSchemaTable().isEdgeTable()) {
    sql+="String_Node_Str";
    sql=printLabeledEdgeInOutVertexIdOuterFromClauseFor(sql,counter,columnNameAliasMapCopy);
  }
  return sql;
}

Fixed version (ground truth):
private String printLabeledOuterFromClause(String sql,int counter,Map<String,String> columnNameAliasMapCopy){
  sql+="String_Node_Str" + counter + "String_Node_Str"+ this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.labeledMappedAliasIdForOuterFromClause(columnNameAliasMapCopy));
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.getSchemaTable().toString());
  if (!propertyTypeMap.isEmpty()) {
    sql+="String_Node_Str";
  }
  sql=this.printLabeledOuterFromClauseFor(sql,counter,columnNameAliasMapCopy);
  if (this.getSchemaTable().isEdgeTable()) {
    sql+="String_Node_Str";
    sql=printLabeledEdgeInOutVertexIdOuterFromClauseFor(sql,counter,columnNameAliasMapCopy);
  }
  return sql;
}
Program: 166954
Project: 166954
Buggy source:
private String printEdgeInOutVertexIdOuterFromClauseFor(String prepend,String sql,SchemaTableTree previousSchemaTableTree){
  Preconditions.checkState(this.getSchemaTable().isEdgeTable());
  Set<String> edgeForeignKeys=this.sqlgGraph.getTopology().getAllEdgeForeignKeys().get(this.getSchemaTable().toString()).stream().filter(foreignKeyName -> foreignKeyName.equals(previousSchemaTableTree.getSchemaTable().withOutPrefix().toString() + SchemaManager.IN_VERTEX_COLUMN_END) || foreignKeyName.equals(previousSchemaTableTree.getSchemaTable().withOutPrefix() + SchemaManager.OUT_VERTEX_COLUMN_END)).collect(Collectors.toSet());
  for (  String edgeForeignKey : edgeForeignKeys) {
    sql+="String_Node_Str";
    sql+=prepend;
    sql+="String_Node_Str";
    sql+=this.mappedAliasPropertyName(edgeForeignKey,this.getColumnNameAliasMap());
    sql+="String_Node_Str";
  }
  return sql;
}

Fixed version (ground truth):
private String printEdgeInOutVertexIdOuterFromClauseFor(String prepend,String sql,SchemaTableTree previousSchemaTableTree){
  Preconditions.checkState(this.getSchemaTable().isEdgeTable());
  Set<String> edgeForeignKeys=this.sqlgGraph.getTopology().getAllEdgeForeignKeys().get(this.getSchemaTable().toString()).stream().filter(foreignKeyName -> foreignKeyName.equals(previousSchemaTableTree.getSchemaTable().withOutPrefix().toString() + SchemaManager.IN_VERTEX_COLUMN_END) || foreignKeyName.equals(previousSchemaTableTree.getSchemaTable().withOutPrefix() + SchemaManager.OUT_VERTEX_COLUMN_END)).collect(Collectors.toSet());
  for (  String edgeForeignKey : edgeForeignKeys) {
    sql+="String_Node_Str";
    sql+=prepend;
    sql+="String_Node_Str";
    sql+=this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.mappedAliasPropertyName(edgeForeignKey,this.getColumnNameAliasMap()));
  }
  return sql;
}
Program: 166955
Project: 166955
Buggy source:
private Optional<String> printEmitMappedAliasIdForOuterFromClause(int countOuter,Map<String,String> columnNameAliasMap){
  Optional<String> optional=this.mappedAliasIdForOuterFromClause(columnNameAliasMap);
  if (optional.isPresent()) {
    return Optional.of("String_Node_Str" + countOuter + "String_Node_Str"+ optional.get()+ "String_Node_Str");
  }
 else {
    return Optional.empty();
  }
}

Fixed version (ground truth):
private Optional<String> printEmitMappedAliasIdForOuterFromClause(int countOuter,Map<String,String> columnNameAliasMap){
  Optional<String> optional=this.mappedAliasIdForOuterFromClause(columnNameAliasMap);
  if (optional.isPresent()) {
    return Optional.of("String_Node_Str" + countOuter + "String_Node_Str"+ this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(optional.get()));
  }
 else {
    return Optional.empty();
  }
}
Program: 166957
Project: 166957
Buggy source:
private String printOuterFromClause(int count,Map<String,String> columnNameAliasMapCopy,SchemaTableTree previousSchemaTableTree){
  String sql="String_Node_Str";
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.toString());
  Optional<String> optional=this.lastMappedAliasIdForOuterFrom(columnNameAliasMapCopy);
  if (optional.isPresent()) {
    sql="String_Node_Str" + count + "String_Node_Str"+ optional.get()+ "String_Node_Str";
    if (propertyTypeMap.size() > 0) {
      sql+="String_Node_Str";
    }
  }
  int propertyCount=1;
  for (  Map.Entry<String,PropertyType> propertyNameEntry : propertyTypeMap.entrySet()) {
    sql+="String_Node_Str" + count + "String_Node_Str"+ this.mappedAliasPropertyName(propertyNameEntry.getKey(),columnNameAliasMapCopy)+ "String_Node_Str";
    for (    String postFix : propertyNameEntry.getValue().getPostFixes()) {
      sql+="String_Node_Str";
      sql+="String_Node_Str" + count + "String_Node_Str"+ this.mappedAliasPropertyName(propertyNameEntry.getKey() + postFix,columnNameAliasMapCopy)+ "String_Node_Str";
    }
    if (propertyCount++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  if (this.getSchemaTable().isEdgeTable()) {
    sql=printEdgeInOutVertexIdOuterFromClauseFor("String_Node_Str" + count,sql,previousSchemaTableTree);
  }
  return sql;
}

Fixed version (ground truth):
private String printOuterFromClause(int count,Map<String,String> columnNameAliasMapCopy,SchemaTableTree previousSchemaTableTree){
  String sql="String_Node_Str";
  Map<String,PropertyType> propertyTypeMap=this.getFilteredAllTables().get(this.toString());
  Optional<String> optional=this.lastMappedAliasIdForOuterFrom(columnNameAliasMapCopy);
  if (optional.isPresent()) {
    sql="String_Node_Str" + count + "String_Node_Str"+ this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(optional.get());
    if (propertyTypeMap.size() > 0) {
      sql+="String_Node_Str";
    }
  }
  int propertyCount=1;
  for (  Map.Entry<String,PropertyType> propertyNameEntry : propertyTypeMap.entrySet()) {
    sql+="String_Node_Str" + count + "String_Node_Str"+ this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.mappedAliasPropertyName(propertyNameEntry.getKey(),columnNameAliasMapCopy));
    for (    String postFix : propertyNameEntry.getValue().getPostFixes()) {
      sql+="String_Node_Str";
      sql+="String_Node_Str" + count + "String_Node_Str"+ this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.mappedAliasPropertyName(propertyNameEntry.getKey() + postFix,columnNameAliasMapCopy));
    }
    if (propertyCount++ < propertyTypeMap.size()) {
      sql+="String_Node_Str";
    }
  }
  if (this.getSchemaTable().isEdgeTable()) {
    sql=printEdgeInOutVertexIdOuterFromClauseFor("String_Node_Str" + count,sql,previousSchemaTableTree);
  }
  return sql;
}
Program: 166959
Project: 166959
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+="String_Node_Str";
    sql+=this.labeledMappedAliasPropertyNameForOuterFromClause(propertyName,columnNameAliasMapCopy);
    sql+="String_Node_Str";
    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 (  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;
}
Program: 166962
Project: 166962
Buggy source:
@Override public void prepareDB(Connection conn){
  String dbName;
  try (Statement st=conn.createStatement();ResultSet rs=st.executeQuery("String_Node_Str")){
    if (!rs.next()) {
      throw new IllegalStateException("String_Node_Str");
    }
    dbName=rs.getString(1);
  }
 catch (  SQLException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  try (Statement st=conn.createStatement()){
    dbName=dbName.replace("String_Node_Str","String_Node_Str");
    st.executeUpdate("String_Node_Str" + dbName + "String_Node_Str");
  }
 catch (  SQLException e) {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void prepareDB(Connection conn){
  String dbName;
  try (Statement st=conn.createStatement();ResultSet rs=st.executeQuery("String_Node_Str")){
    if (!rs.next()) {
      throw new IllegalStateException("String_Node_Str");
    }
    dbName=rs.getString(1);
  }
 catch (  SQLException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  try (Statement st=conn.createStatement()){
    dbName=dbName.replace("String_Node_Str","String_Node_Str");
    st.executeUpdate("String_Node_Str" + dbName + "String_Node_Str");
  }
 catch (  SQLException e) {
    if (!e.getMessage().toLowerCase().contains("String_Node_Str")) {
      throw new IllegalStateException("String_Node_Str",e);
    }
  }
}
Program: 166965
Project: 166965
Buggy source:
@Override public void change(TopologyInf topologyInf,String oldValue,TopologyChangeAction action){
  topologyListenerTriple.add(Triple.of(topologyInf,oldValue,action));
}

Fixed version (ground truth):
@Override public void change(TopologyInf topologyInf,String oldValue,TopologyChangeAction action){
  String s=topologyInf.toString();
  assertNotNull(s);
  assertTrue(s + "String_Node_Str" + topologyInf.getName(),s.contains(topologyInf.getName()));
  topologyListenerTriple.add(Triple.of(topologyInf,oldValue,action));
}
Program: 166967
Project: 166967
Buggy source:
private void afterRollback(){
  this.temporaryTables.clear();
  if (this.isWriteLockHeldByCurrentThread()) {
    for (Iterator<Map.Entry<String,Schema>> it=this.uncommittedSchemas.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry<String,Schema> entry=it.next();
      entry.getValue().afterRollback();
      it.remove();
    }
    z_internalReadLock();
    try {
      for (      Schema schema : this.schemas.values()) {
        schema.afterRollback();
      }
    }
  finally {
      z_internalReadUnLock();
    }
    this.reentrantReadWriteLock.writeLock().unlock();
  }
}

Fixed version (ground truth):
private void afterRollback(){
  this.temporaryTables.clear();
  if (this.isWriteLockHeldByCurrentThread()) {
    for (Iterator<Map.Entry<String,Schema>> it=this.uncommittedSchemas.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry<String,Schema> entry=it.next();
      entry.getValue().afterRollback();
      it.remove();
    }
    z_internalReadLock();
    try {
      for (      Schema schema : this.schemas.values()) {
        schema.afterRollback();
      }
    }
  finally {
      z_internalReadUnLock();
    }
    this.uncommittedGlobalUniqueIndexes.clear();
    this.reentrantReadWriteLock.writeLock().unlock();
  }
}
Program: 166969
Project: 166969
Buggy source:
public void loadProperty(ResultSet resultSet,SqlgElement sqlgElement) throws SQLException {
  for (int ix=1; ix <= resultSet.getMetaData().getColumnCount(); ix++) {
    String columnName=resultSet.getMetaData().getColumnLabel(ix);
    Pair<String,PropertyType> p=getColumnNamePropertyName().get(columnName);
    if (p != null) {
      String propertyName=p.getKey();
      PropertyType propertyType=p.getValue();
      Object o=(propertyType != null && propertyType.isArray() && propertyType != PropertyType.byte_ARRAY && propertyType != PropertyType.BYTE_ARRAY) ? resultSet.getArray(ix) : resultSet.getObject(ix);
      if (!Objects.isNull(o)) {
        if (propertyName.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
          ((SqlgEdge)sqlgElement).loadInVertex(resultSet,propertyName,ix);
        }
 else         if (propertyName.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
          ((SqlgEdge)sqlgElement).loadOutVertex(resultSet,propertyName,ix);
        }
 else {
          sqlgElement.loadProperty(resultSet,propertyName,o,getColumnNameAliasMap(),this.stepDepth,propertyType);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void loadProperty(ResultSet resultSet,SqlgElement sqlgElement) throws SQLException {
  for (int ix=1; ix <= resultSet.getMetaData().getColumnCount(); ix++) {
    String columnName=resultSet.getMetaData().getColumnLabel(ix);
    Pair<String,PropertyType> p=getColumnNamePropertyName().get(columnName);
    if (p != null) {
      String propertyName=p.getKey();
      PropertyType propertyType=p.getValue();
      if (propertyName.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
        ((SqlgEdge)sqlgElement).loadInVertex(resultSet,propertyName,ix);
      }
 else       if (propertyName.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
        ((SqlgEdge)sqlgElement).loadOutVertex(resultSet,propertyName,ix);
      }
 else {
        sqlgElement.loadProperty(resultSet,propertyName,ix,getColumnNameAliasMap(),this.stepDepth,propertyType);
      }
    }
  }
}
Program: 166970
Project: 166970
Buggy source:
public void loadOutVertex(ResultSet resultSet,String label,int columnIdx) throws SQLException {
  SchemaTable outVertexColumnName=SchemaTable.from(this.sqlgGraph,label,this.sqlgGraph.getSqlDialect().getPublicSchema());
  Long outId=resultSet.getLong(columnIdx);
  this.outVertex=SqlgVertex.of(this.sqlgGraph,outId,outVertexColumnName.getSchema(),SqlgUtil.removeTrailingOutId(outVertexColumnName.getTable()));
}

Fixed version (ground truth):
public void loadOutVertex(ResultSet resultSet,String label,int columnIdx) throws SQLException {
  SchemaTable outVertexColumnName=SchemaTable.from(this.sqlgGraph,label,this.sqlgGraph.getSqlDialect().getPublicSchema());
  Long outId=resultSet.getLong(columnIdx);
  if (!resultSet.wasNull()) {
    this.outVertex=SqlgVertex.of(this.sqlgGraph,outId,outVertexColumnName.getSchema(),SqlgUtil.removeTrailingOutId(outVertexColumnName.getTable()));
  }
}
Program: 166971
Project: 166971
Buggy source:
public void loadInVertex(ResultSet resultSet,String label,int columnIdx) throws SQLException {
  SchemaTable inVertexColumnName=SchemaTable.from(this.sqlgGraph,label,this.sqlgGraph.getSqlDialect().getPublicSchema());
  Long inId=resultSet.getLong(columnIdx);
  this.inVertex=SqlgVertex.of(this.sqlgGraph,inId,inVertexColumnName.getSchema(),SqlgUtil.removeTrailingInId(inVertexColumnName.getTable()));
}

Fixed version (ground truth):
public void loadInVertex(ResultSet resultSet,String label,int columnIdx) throws SQLException {
  SchemaTable inVertexColumnName=SchemaTable.from(this.sqlgGraph,label,this.sqlgGraph.getSqlDialect().getPublicSchema());
  Long inId=resultSet.getLong(columnIdx);
  if (!resultSet.wasNull()) {
    this.inVertex=SqlgVertex.of(this.sqlgGraph,inId,inVertexColumnName.getSchema(),SqlgUtil.removeTrailingInId(inVertexColumnName.getTable()));
  }
}
Program: 166973
Project: 166973
Buggy source:
@Override public E next(){
  List<Emit<SqlgElement>> result=this.elements;
  this.elements=null;
  return (E)result;
}

Fixed version (ground truth):
@Override public E next(){
  if (lazy) {
    return nextLazy();
  }
  return (E)allElements.next();
}
Program: 166974
Project: 166974
Buggy source:
public SqlgCompiledResultIterator(SqlgGraph sqlgGraph,Set<SchemaTableTree> rootSchemaTableTrees){
  this.sqlgGraph=sqlgGraph;
  this.rootSchemaTableTrees=rootSchemaTableTrees;
  this.rootSchemaTableTreeIterator=rootSchemaTableTrees.iterator();
}

Fixed version (ground truth):
public SqlgCompiledResultIterator(SqlgGraph sqlgGraph,Set<SchemaTableTree> rootSchemaTableTrees){
  this.sqlgGraph=sqlgGraph;
  this.rootSchemaTableTrees=rootSchemaTableTrees;
  this.rootSchemaTableTreeIterator=rootSchemaTableTrees.iterator();
  this.lazy=sqlgGraph.tx().isLazyQueries();
}
Program: 166976
Project: 166976
Buggy source:
@Override protected void doOpen(){
  if (isOpen())   throw Transaction.Exceptions.transactionAlreadyOpen();
 else {
    try {
      Connection connection=this.sqlgGraph.getSqlgDataSource().get(this.sqlgGraph.getJdbcUrl()).getConnection();
      connection.setAutoCommit(false);
      if (this.sqlgGraph.getSqlDialect().supportsClientInfo()) {
        connection.setClientInfo("String_Node_Str",Thread.currentThread().getName());
      }
      this.threadLocalTx.set(TransactionCache.of(this.cacheVertices,connection,new BatchManager(this.sqlgGraph,((SqlBulkDialect)this.sqlgGraph.getSqlDialect()))));
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doOpen(){
  if (isOpen())   throw Transaction.Exceptions.transactionAlreadyOpen();
 else {
    try {
      Connection connection=this.sqlgGraph.getSqlgDataSource().get(this.sqlgGraph.getJdbcUrl()).getConnection();
      connection.setAutoCommit(false);
      if (this.sqlgGraph.getSqlDialect().supportsClientInfo()) {
        connection.setClientInfo("String_Node_Str",Thread.currentThread().getName());
      }
      boolean lazy=this.sqlgGraph.getConfiguration().getBoolean(QUERY_LAZY,true);
      this.threadLocalTx.set(TransactionCache.of(this.cacheVertices,connection,new BatchManager(this.sqlgGraph,((SqlBulkDialect)this.sqlgGraph.getSqlDialect())),lazy));
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 166977
Project: 166977
Buggy source:
private Iterator<Edge> internalEdges(Direction direction,String... labels){
  this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode() && this.sqlgGraph.tx().getBatchManager().vertexIsCached(this)) {
    this.sqlgGraph.tx().flush();
  }
switch (direction) {
case OUT:
    return this.sqlgGraph.traversal().V(this).outE(labels).toList().iterator();
case IN:
  return this.sqlgGraph.traversal().V(this).inE(labels).toList().iterator();
case BOTH:
return this.sqlgGraph.traversal().V(this).bothE(labels).toList().iterator();
}
return Collections.emptyIterator();
}

Fixed version (ground truth):
private Iterator<Edge> internalEdges(Direction direction,String... labels){
  this.sqlgGraph.tx().readWrite();
  if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInBatchMode() && this.sqlgGraph.tx().getBatchManager().vertexIsCached(this)) {
    this.sqlgGraph.tx().flush();
  }
switch (direction) {
case OUT:
    return this.sqlgGraph.traversal().V(this).outE(labels);
case IN:
  return this.sqlgGraph.traversal().V(this).inE(labels);
case BOTH:
return this.sqlgGraph.traversal().V(this).bothE(labels);
}
return Collections.emptyIterator();
}