nus-yam/ex-repair huggingface dataset:
Program: 97943
Project: 97943
Buggy source:
public JoinMeta fetchJoinMeta(JoinMeta rightSide){
  Set<ViewInfo> views1=this.getViews();
  Set<ViewInfo> views2=rightSide.getViews();
  for (  ViewInfo infoL : views1) {
    for (    ViewInfo infoR : views2) {
      JoinInfo joinInfo=infoL.findViewMatch(infoR);
      if (joinInfo != null) {
        Set<JoinInfo> set1=this.getJoinInfoSet();
        Set<JoinInfo> set2=rightSide.getJoinInfoSet();
        JoinMeta meta=new JoinMeta(joinInfo,JoinType.NONE,set1,set2);
        return meta;
      }
    }
  }
  for (  ViewInfo infoL : views1) {
    for (    ViewInfo infoR : views2) {
      JoinInfo joinInfo=infoL.getJoinInfo(infoR);
      if (joinInfo != null) {
        Set<JoinInfo> set1=this.getJoinInfoSet();
        Set<JoinInfo> set2=rightSide.getJoinInfoSet();
        JoinMeta meta=new JoinMeta(joinInfo,JoinType.NONE,set1,set2);
        return meta;
      }
    }
  }
  throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + views1 + "String_Node_Str"+ views2+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public JoinMeta fetchJoinMeta(JoinMeta rightSide){
  Set<ViewInfo> views1=this.getViews();
  Set<ViewInfo> views2=rightSide.getViews();
  for (  ViewInfo infoL : views1) {
    for (    ViewInfo infoR : views2) {
      JoinInfo joinInfo=infoL.findViewMatch(infoR);
      if (joinInfo != null) {
        Set<JoinInfo> set1=this.getJoinInfoSet();
        Set<JoinInfo> set2=rightSide.getJoinInfoSet();
        JoinMeta meta=new JoinMeta(joinInfo,JoinType.NONE,set1,set2);
        return meta;
      }
    }
  }
  for (  ViewInfo infoL : views1) {
    for (    ViewInfo infoR : views2) {
      JoinInfo joinInfo=infoL.getJoinInfo(infoR);
      if (joinInfo != null) {
        Set<JoinInfo> set1=this.getJoinInfoSet();
        Set<JoinInfo> set2=rightSide.getJoinInfoSet();
        JoinMeta meta=new JoinMeta(joinInfo,joinInfo.getJoinType(),set1,set2);
        return meta;
      }
    }
  }
  throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + views1 + "String_Node_Str"+ views2+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 97944
Project: 97944
Buggy source:
private Key createLeftKey(ExpressionNode node,DboColumnMeta info){
  byte[] data=retrieveValue(info,node.getRightChild());
  if (node.getType() == NoSqlLexer.LT)   return new Key(data,false);
 else   if (node.getType() == NoSqlLexer.LE)   return new Key(data,true);
 else   throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
private Key createLeftKey(ExpressionNode node,DboColumnMeta info){
  byte[] data=retrieveValue(info,node.getRightChild());
  if (node.getType() == NoSqlLexer.GT)   return new Key(data,false);
 else   if (node.getType() == NoSqlLexer.GE)   return new Key(data,true);
 else   throw new RuntimeException("String_Node_Str" + node.getType());
}
Program: 97945
Project: 97945
Buggy source:
private Key createRightKey(ExpressionNode node,DboColumnMeta info){
  byte[] data=retrieveValue(info,node.getRightChild());
  if (node.getType() == NoSqlLexer.GT)   return new Key(data,false);
 else   if (node.getType() == NoSqlLexer.GE)   return new Key(data,true);
 else   throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
private Key createRightKey(ExpressionNode node,DboColumnMeta info){
  byte[] data=retrieveValue(info,node.getRightChild());
  if (node.getType() == NoSqlLexer.LT)   return new Key(data,false);
 else   if (node.getType() == NoSqlLexer.LE)   return new Key(data,true);
 else   throw new RuntimeException("String_Node_Str");
}
Program: 97946
Project: 97946
Buggy source:
@Override public Collection<Column> columnSlice(Key from,Key to){
  NavigableMap<OurKey,IndexColumn> resultMap=columns;
  if (from != null) {
    OurKey fromKey=new OurKey(from.getKey(),new byte[0]);
    resultMap=columns.tailMap(fromKey,from.isInclusive());
  }
  if (to != null) {
    OurKey toKey=new OurKey(to.getKey(),null);
    resultMap=columns.headMap(toKey,to.isInclusive());
  }
  List<Column> results=new ArrayList<Column>();
  for (  IndexColumn c : resultMap.values()) {
    Column col=new Column();
    col.setName(c.getPrimaryKey());
    results.add(col);
  }
  return results;
}

Fixed version (ground truth):
@Override public Collection<Column> columnSlice(Key from,Key to){
  NavigableMap<OurKey,IndexColumn> resultMap=columns;
  if (from != null) {
    OurKey fromKey=new OurKey(from.getKey(),new byte[0]);
    resultMap=columns.tailMap(fromKey,from.isInclusive());
  }
  if (to != null) {
    OurKey toKey=new OurKey(to.getKey(),null);
    resultMap=resultMap.headMap(toKey,to.isInclusive());
  }
  List<Column> results=new ArrayList<Column>();
  for (  IndexColumn c : resultMap.values()) {
    Column col=new Column();
    col.setName(c.getPrimaryKey());
    results.add(col);
  }
  return results;
}
Program: 97947
Project: 97947
Buggy source:
@Override public List<Row> find(String colFamily,List<byte[]> rowKeys){
  List<Row> rows=new ArrayList<Row>();
  List<byte[]> rowKeysToFetch=new ArrayList<byte[]>();
  List<Integer> indexForRow=new ArrayList<Integer>();
  for (int i=0; i < rowKeys.size(); i++) {
    byte[] key=rowKeys.get(i);
    RowHolder<Row> result=fromCache(colFamily,key);
    if (result == null) {
      indexForRow.add(i);
      rowKeysToFetch.add(key);
      rows.add(null);
    }
 else {
      log.info("String_Node_Str");
      rows.add(result.getValue());
    }
  }
  List<Row> rowsFromDb=session.find(colFamily,rowKeysToFetch);
  for (int i=0; i < rowKeysToFetch.size(); i++) {
    Integer index=indexForRow.get(i);
    Row r=rowsFromDb.get(i);
    byte[] key=rowKeysToFetch.get(i);
    rows.set(index,r);
    cacheRow(colFamily,key,r);
  }
  return rows;
}

Fixed version (ground truth):
@Override public List<Row> find(String colFamily,List<byte[]> rowKeys){
  List<Row> rows=new ArrayList<Row>();
  List<byte[]> rowKeysToFetch=new ArrayList<byte[]>();
  List<Integer> indexForRow=new ArrayList<Integer>();
  for (int i=0; i < rowKeys.size(); i++) {
    byte[] key=rowKeys.get(i);
    RowHolder<Row> result=fromCache(colFamily,key);
    if (result == null) {
      indexForRow.add(i);
      rowKeysToFetch.add(key);
      rows.add(null);
    }
 else {
      log.info("String_Node_Str");
      rows.add(result.getValue());
    }
  }
  List<Row> rowsFromDb=new ArrayList<Row>();
  if (rowKeysToFetch.size() > 0)   rowsFromDb=session.find(colFamily,rowKeysToFetch);
  for (int i=0; i < rowKeysToFetch.size(); i++) {
    Integer index=indexForRow.get(i);
    Row r=rowsFromDb.get(i);
    byte[] key=rowKeysToFetch.get(i);
    rows.set(index,r);
    cacheRow(colFamily,key,r);
  }
  return rows;
}
Program: 97948
Project: 97948
Buggy source:
public void setRowKeyMeta(DboColumnMeta idMeta){
  this.idColumn.setOwner(this);
  this.idColumn=idMeta;
}

Fixed version (ground truth):
public void setRowKeyMeta(DboColumnMeta idMeta){
  this.idColumn=idMeta;
  this.idColumn.setOwner(this);
}
Program: 97951
Project: 97951
Buggy source:
public Object fetchId(T entity){
  return ReflectionUtil.fetchFieldValue(entity,idField.getField());
}

Fixed version (ground truth):
public Object fetchId(T entity){
  if (entity == null)   return null;
  return ReflectionUtil.fetchFieldValue(entity,idField.getField());
}
Program: 97952
Project: 97952
Buggy source:
@SuppressWarnings("String_Node_Str") public void setup(IdInfo info,Field field2,String columnName,String indexPrefix){
  this.method=info.getIdMethod();
  this.method.setAccessible(true);
  this.useGenerator=info.isUseGenerator();
  this.generator=info.getGen();
  this.converter=info.getConverter();
  this.metaClass=info.getMetaClass();
  super.setup(field2,columnName,null,field.getType(),false,indexPrefix);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void setup(IdInfo info,Field field,String columnName,String indexPrefix){
  this.method=info.getIdMethod();
  this.method.setAccessible(true);
  this.useGenerator=info.isUseGenerator();
  this.generator=info.getGen();
  this.converter=info.getConverter();
  this.metaClass=info.getMetaClass();
  super.setup(field,columnName,null,field.getType(),false,indexPrefix);
}
Program: 97953
Project: 97953
Buggy source:
/** 
 * @param self - The proxy object(if you call any method on self, it will result in calling invoke methodAND that includes a simple toString like if you did log.info("proxy="+self);
 * @param superClassMethod - The method that is on the superclass like Account.java
 * @param subclassProxyMethod - The method that is on the proxy like Account_$$_javassist_0
 */
@SuppressWarnings("String_Node_Str") @Override public Object invoke(Object selfArg,Method superClassMethod,Method subclassProxyMethod,Object[] args) throws Throwable {
  T self=(T)selfArg;
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + superClassMethod.getName() + "String_Node_Str"+ superClassMethod.getDeclaringClass());
    log.trace("String_Node_Str" + subclassProxyMethod.getName() + "String_Node_Str"+ subclassProxyMethod.getDeclaringClass());
  }
  if (idMethod.equals(superClassMethod))   return entityId;
 else   if ("String_Node_Str".equals(subclassProxyMethod.getName())) {
    cacheIndexedValues(self);
    isInitialized=true;
    return null;
  }
 else   if ("String_Node_Str".equals(subclassProxyMethod.getName())) {
    return getOriginalValues();
  }
  if (!isInitialized) {
    if (cacheLoadCallback != null) {
      cacheLoadCallback.loadCacheIfNeeded();
    }
 else {
      fillInThisOneInstance(self);
    }
    isInitialized=true;
  }
  return subclassProxyMethod.invoke(self,args);
}

Fixed version (ground truth):
/** 
 * @param self - The proxy object(if you call any method on self, it will result in calling invoke methodAND that includes a simple toString like if you did log.info("proxy="+self);
 * @param superClassMethod - The method that is on the superclass like Account.java
 * @param subclassProxyMethod - The method that is on the proxy like Account_$$_javassist_0
 */
@SuppressWarnings("String_Node_Str") @Override public Object invoke(Object selfArg,Method superClassMethod,Method subclassProxyMethod,Object[] args) throws Throwable {
  T self=(T)selfArg;
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + superClassMethod.getName() + "String_Node_Str"+ superClassMethod.getDeclaringClass());
    log.trace("String_Node_Str" + subclassProxyMethod.getName() + "String_Node_Str"+ subclassProxyMethod.getDeclaringClass());
  }
  if (idMethod.equals(superClassMethod))   return entityId;
 else   if ("String_Node_Str".equals(superClassMethod.getName())) {
    cacheIndexedValues(self);
    isInitialized=true;
    return null;
  }
 else   if ("String_Node_Str".equals(superClassMethod.getName())) {
    return getOriginalValues();
  }
  if (!isInitialized) {
    if (cacheLoadCallback != null) {
      cacheLoadCallback.loadCacheIfNeeded();
    }
 else {
      fillInThisOneInstance(self);
    }
    isInitialized=true;
  }
  return subclassProxyMethod.invoke(self,args);
}
Program: 97954
Project: 97954
Buggy source:
@Test public void testBasicChangeToIndex(){
  User user=new User();
  user.setName("String_Node_Str");
  user.setLastName("String_Node_Str");
  mgr.put(user);
  mgr.flush();
  User result=User.findByName(mgr,user.getName());
  Assert.assertEquals(user.getName(),result.getName());
  result.setName("String_Node_Str");
  mgr.put(result);
  User newResult=User.findByName(mgr,user.getName());
  Assert.assertNull(newResult);
  User newerResult=User.findByName(mgr,result.getName());
  Assert.assertEquals(result.getName(),newerResult.getName());
}

Fixed version (ground truth):
@Test public void testBasicChangeToIndex(){
  User user=new User();
  user.setName("String_Node_Str");
  user.setLastName("String_Node_Str");
  mgr.put(user);
  mgr.flush();
  User result=User.findByName(mgr,user.getName());
  Assert.assertEquals(user.getName(),result.getName());
  result.setName("String_Node_Str");
  mgr.put(result);
  mgr.flush();
  User newResult=User.findByName(mgr,user.getName());
  Assert.assertNull(newResult);
  User newerResult=User.findByName(mgr,result.getName());
  Assert.assertEquals(result.getName(),newerResult.getName());
}
Program: 97955
Project: 97955
Buggy source:
private Object fetchFinalId(Object entity){
  Object id=ReflectionUtil.fetchFieldValue(entity,field);
  if (!useGenerator) {
    if (id == null)     throw new IllegalArgumentException("String_Node_Str" + entity);
    return id;
  }
 else   if (id != null)   return id;
  Object newId=generator.generateNewKey(entity);
  ReflectionUtil.putFieldValue(entity,field,newId);
  return newId;
}

Fixed version (ground truth):
private Object fetchFinalId(Object idInEntity,Object entity){
  Object id=idInEntity;
  if (!useGenerator) {
    if (id == null)     throw new IllegalArgumentException("String_Node_Str" + entity);
    return id;
  }
 else   if (id != null)   return id;
  Object newId=generator.generateNewKey(entity);
  ReflectionUtil.putFieldValue(entity,field,newId);
  return newId;
}
Program: 97956
Project: 97956
Buggy source:
public void translateFromRow(Row row,Object entity){
  byte[] rowKey=row.getKey();
  Object value=convertIdFromNoSql(rowKey);
  ReflectionUtil.putFieldValue(entity,field,value);
}

Fixed version (ground truth):
public void translateFromRow(Row row,Object entity){
  byte[] rowKey=row.getKey();
  Object value=converter.convertFromNoSql(rowKey);
  ReflectionUtil.putFieldValue(entity,field,value);
}
Program: 97957
Project: 97957
Buggy source:
public void translateToRow(Object entity,RowToPersist row){
  Object value=ReflectionUtil.fetchFieldValue(entity,field);
  Object id=fetchFinalId(value);
  byte[] byteVal=convertIdToNoSql(id);
  row.setKey(byteVal);
}

Fixed version (ground truth):
public void translateToRow(Object entity,RowToPersist row){
  Object idInEntity=ReflectionUtil.fetchFieldValue(entity,field);
  Object id=fetchFinalId(idInEntity,entity);
  byte[] byteVal=converter.convertToNoSql(id);
  row.setKey(byteVal);
}
Program: 97958
Project: 97958
Buggy source:
public void translateToColumn(Object entity,Column col){
  Object value=ReflectionUtil.fetchFieldValue(entity,field);
  byte[] byteVal=classMeta.convertIdToNoSql(value);
  col.setName(columnName);
  col.setValue(byteVal);
}

Fixed version (ground truth):
public void translateToColumn(Object entity,Column col){
  Object value=ReflectionUtil.fetchFieldValue(entity,field);
  byte[] byteVal=classMeta.convertProxyToId(value);
  col.setName(columnName);
  col.setValue(byteVal);
}
Program: 97959
Project: 97959
Buggy source:
public void translateFromColumn(Map<String,Column> columns,Object entity){
  Column column=columns.get(columnName);
  Object value=classMeta.convertIdFromNoSql(column.getValue());
  ReflectionUtil.putFieldValue(entity,field,value);
}

Fixed version (ground truth):
public void translateFromColumn(Map<String,Column> columns,Object entity){
  Column column=columns.get(columnName);
  Object proxy=classMeta.convertIdToProxy(column.getValue());
  ReflectionUtil.putFieldValue(entity,field,proxy);
}
Program: 97960
Project: 97960
Buggy source:
@Override public void close(StorageChannel channel){
  if (!views.remove(channel) && channel != indexChannel) {
    throw new IllegalStateException();
  }
  if (views.isEmpty()) {
    System.err.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void close(StorageChannel channel){
  if (!views.remove(channel) && channel != indexChannel) {
    throw new IllegalStateException();
  }
}
Program: 97961
Project: 97961
Buggy source:
public void close(){
  if (!isOpen) {
    throw DBLogger.newUser("String_Node_Str");
  }
  try {
    lock();
    for (    Node n : nodes) {
      n.closeConnection();
    }
    cache.close();
    closeResources();
    TransientField.deregisterPm(this);
    isOpen=false;
  }
  finally {
    unlock();
  }
  LOGGER.info("String_Node_Str",System.identityHashCode(this));
}

Fixed version (ground truth):
public void close(){
  try {
    lock();
    if (!isOpen) {
      throw DBLogger.newUser("String_Node_Str");
    }
    for (    Node n : nodes) {
      n.closeConnection();
    }
    cache.close();
    closeResources();
    TransientField.deregisterPm(this);
    isOpen=false;
  }
  finally {
    unlock();
  }
  LOGGER.info("String_Node_Str",System.identityHashCode(this));
}
Program: 97962
Project: 97962
Buggy source:
/** 
 * Read objects. This should never be necessary. TODO add warning? TODO Only required for queries without index, which is worth a warning anyway. SEE readAllObjects()!
 * @param clsPx ClassProxy
 * @param subClasses whether to include subclasses
 */
@Override public CloseableIterator<ZooHandleImpl> oidIterator(ZooClassProxy clsPx,boolean subClasses){
  SchemaIndexEntry se=schemaIndex.getSchema(clsPx.getSchemaId());
  if (se == null) {
    throw new IllegalStateException("String_Node_Str" + clsPx);
  }
  ZooHandleIteratorAdapter it=new ZooHandleIteratorAdapter(se.getObjectIndexIterator(),objectReader,cache);
  return it;
}

Fixed version (ground truth):
/** 
 * Read objects. Only required for queries without index, which is worth a warning anyway. SEE readAllObjects()!
 * @param clsPx ClassProxy
 * @param subClasses whether to include subclasses
 */
@Override public CloseableIterator<ZooHandleImpl> oidIterator(ZooClassProxy clsPx,boolean subClasses){
  SchemaIndexEntry se=schemaIndex.getSchema(clsPx.getSchemaId());
  if (se == null) {
    throw new IllegalStateException("String_Node_Str" + clsPx);
  }
  return new ZooHandleIteratorAdapter(se.getObjectIndexIterator(),objectReader,cache);
}
Program: 97963
Project: 97963
Buggy source:
/** 
 * Read objects. This should never be necessary. TODO add warning? TODO Only required for queries without index, which is worth a warning anyway. SEE oidIterator()!
 * @param schemaId Schema ID
 * @param loadFromCache Whether to load data from cache, if possible
 */
@Override public CloseableIterator<ZooPC> readAllObjects(long schemaId,boolean loadFromCache){
  SchemaIndexEntry se=schemaIndex.getSchema(schemaId);
  if (se == null) {
    throw DBLogger.newUser("String_Node_Str" + schemaId);
  }
  return new ObjectPosIterator(se.getObjectIndexIterator(),cache,objectReader,loadFromCache);
}

Fixed version (ground truth):
/** 
 * Read objects. Only required for queries without index, which is worth a warning anyway. SEE oidIterator()!
 * @param schemaId Schema ID
 * @param loadFromCache Whether to load data from cache, if possible
 */
@Override public CloseableIterator<ZooPC> readAllObjects(long schemaId,boolean loadFromCache){
  SchemaIndexEntry se=schemaIndex.getSchema(schemaId);
  if (se == null) {
    throw DBLogger.newUser("String_Node_Str" + schemaId);
  }
  return new ObjectPosIterator(se.getObjectIndexIterator(),cache,objectReader,loadFromCache);
}
Program: 97964
Project: 97964
Buggy source:
@Override public OptimisticTransactionResult checkTxConsistency(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,true);
  if (ovr.hasFailed()) {
    return ovr;
  }
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  return ovr;
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult checkTxConsistency(ArrayList<TxObjInfo> updates){
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,true);
  if (ovr.hasFailed()) {
    return ovr;
  }
  return ovr;
}
Program: 97965
Project: 97965
Buggy source:
/** 
 * @return List of all schemata in the database. These are loaded when the database is opened.
 */
@Override public Collection<ZooClassDef> readSchemaAll(){
  Collection<ZooClassDef> all=schemaIndex.readSchemaAll(this,node);
  if (all.isEmpty()) {
    ZooClassDef zpcDef=ZooClassDef.bootstrapZooPCImpl();
    ZooClassDef meta=ZooClassDef.bootstrapZooClassDef();
    schemaIndex.defineSchema(zpcDef);
    schemaIndex.defineSchema(meta);
    all=new ArrayList<ZooClassDef>();
    all.add(zpcDef);
    all.add(meta);
  }
  txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
  txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
  return all;
}

Fixed version (ground truth):
/** 
 * @return List of all schemata in the database. These are loaded when the database is opened.
 */
@Override public Collection<ZooClassDef> readSchemaAll(){
  Collection<ZooClassDef> all=schemaIndex.readSchemaAll(this,node);
  if (all.isEmpty()) {
    ZooClassDef zpcDef=ZooClassDef.bootstrapZooPCImpl();
    ZooClassDef meta=ZooClassDef.bootstrapZooClassDef();
    schemaIndex.defineSchema(zpcDef);
    schemaIndex.defineSchema(meta);
    all=new ArrayList<>();
    all.add(zpcDef);
    all.add(meta);
  }
  txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
  txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
  return all;
}
Program: 97966
Project: 97966
Buggy source:
/** 
 * WARNING: float/double values need to be converted with BitTools before used on indices. 
 */
@Override public CloseableIterator<ZooPC> readObjectFromIndex(ZooFieldDef field,long minValue,long maxValue,boolean loadFromCache){
  SchemaIndexEntry se=schemaIndex.getSchema(field.getDeclaringType());
  LongLongIndex fieldInd=(LongLongIndex)se.getIndex(field);
  LLEntryIterator iter=fieldInd.iterator(minValue,maxValue);
  return new ObjectIterator(iter,cache,this,objectReader,loadFromCache);
}

Fixed version (ground truth):
/** 
 * WARNING: float/double values need to be converted with BitTools before used on indices. 
 */
@Override public CloseableIterator<ZooPC> readObjectFromIndex(ZooFieldDef field,long minValue,long maxValue,boolean loadFromCache){
  SchemaIndexEntry se=schemaIndex.getSchema(field.getDeclaringType());
  LongLongIndex fieldInd=se.getIndex(field);
  LLEntryIterator iter=fieldInd.iterator(minValue,maxValue);
  return new ObjectIterator(iter,cache,this,objectReader,loadFromCache);
}
Program: 97967
Project: 97967
Buggy source:
@Override public long[] allocateOids(int oidAllocSize){
  long[] ret=oidIndex.allocateOids(oidAllocSize);
  return ret;
}

Fixed version (ground truth):
@Override public long[] allocateOids(int oidAllocSize){
  return oidIndex.allocateOids(oidAllocSize);
}
Program: 97968
Project: 97968
Buggy source:
@Deprecated public static void allowReadConcurrency(boolean allowReadConcurrency){
  System.err.println("String_Node_Str");
  ALLOW_READ_CONCURRENCY=allowReadConcurrency;
}

Fixed version (ground truth):
@Deprecated public static void allowReadConcurrency(boolean allowReadConcurrency){
  ALLOW_READ_CONCURRENCY=allowReadConcurrency;
}
Program: 97969
Project: 97969
Buggy source:
/** 
 * Defines an index and populates it. All objects are put into the cache. This is not  necessarily useful, but it is a one-off operation. Otherwise we would need a special purpose implementation of the deserializer, which would have the need for a cache removed.
 */
@Override public void defineIndex(ZooClassDef def,ZooFieldDef field,boolean isUnique){
  SchemaIndexEntry se=schemaIndex.getSchema(def);
  LongLongIndex fieldInd=(LongLongIndex)se.defineIndex(field,isUnique);
  PagedPosIndex ind=se.getObjectIndexLatestSchemaVersion();
  PagedPosIndex.ObjectPosIterator iter=ind.iteratorObjects();
  DataDeSerializerNoClass dds=new DataDeSerializerNoClass(fileInAP);
  if (field.isPrimitiveType()) {
    while (iter.hasNext()) {
      long pos=iter.nextPos();
      dds.seekPos(pos);
      long key=dds.getAttrAsLong(def,field);
      if (isUnique) {
        if (!fieldInd.insertLongIfNotSet(key,dds.getLastOid())) {
          throw DBLogger.newUser("String_Node_Str" + Util.oidToString(dds.getLastOid()) + "String_Node_Str"+ key);
        }
      }
 else {
        fieldInd.insertLong(key,dds.getLastOid());
      }
    }
  }
 else {
    while (iter.hasNext()) {
      long pos=iter.nextPos();
      dds.seekPos(pos);
      long key=dds.getAttrAsLongObjectNotNull(def,field);
      fieldInd.insertLong(key,dds.getLastOid());
    }
  }
  iter.close();
}

Fixed version (ground truth):
/** 
 * Defines an index and populates it. All objects are put into the cache. This is not  necessarily useful, but it is a one-off operation. Otherwise we would need a special purpose implementation of the deserializer, which would have the need for a cache removed.
 */
@Override public void defineIndex(ZooClassDef def,ZooFieldDef field,boolean isUnique){
  SchemaIndexEntry se=schemaIndex.getSchema(def);
  LongLongIndex fieldInd=se.defineIndex(field,isUnique);
  PagedPosIndex ind=se.getObjectIndexLatestSchemaVersion();
  PagedPosIndex.ObjectPosIterator iter=ind.iteratorObjects();
  DataDeSerializerNoClass dds=new DataDeSerializerNoClass(fileInAP);
  if (field.isPrimitiveType()) {
    while (iter.hasNext()) {
      long pos=iter.nextPos();
      dds.seekPos(pos);
      long key=dds.getAttrAsLong(def,field);
      if (isUnique) {
        if (!fieldInd.insertLongIfNotSet(key,dds.getLastOid())) {
          throw DBLogger.newUser("String_Node_Str" + Util.oidToString(dds.getLastOid()) + "String_Node_Str"+ key);
        }
      }
 else {
        fieldInd.insertLong(key,dds.getLastOid());
      }
    }
  }
 else {
    while (iter.hasNext()) {
      long pos=iter.nextPos();
      dds.seekPos(pos);
      long key=dds.getAttrAsLongObjectNotNull(def,field);
      fieldInd.insertLong(key,dds.getLastOid());
    }
  }
  iter.close();
}
Program: 97970
Project: 97970
Buggy source:
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.startWriting(txId);
  sm.startWriting(txId);
  freeIndex.notifyBegin(txId);
  return ovr;
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.startWriting(txId);
  sm.startWriting(txId);
  return ovr;
}
Program: 97971
Project: 97971
Buggy source:
public static DiskAccessOneFile getSession(Node node,AbstractCache cache){
  String dbPath=node.getDbPath();
  LOGGER.info("String_Node_Str",dbPath);
  Path path=FileSystems.getDefault().getPath(dbPath);
  SessionManager sm=null;
synchronized (sessions) {
    try {
      for (      SessionManager smi : sessions) {
        if (Files.isSameFile(smi.getPath(),path)) {
          sm=smi;
          break;
        }
      }
    }
 catch (    IOException e) {
      throw DBLogger.newFatal("String_Node_Str" + dbPath,e);
    }
    if (sm == null) {
      sm=new SessionManager(path);
      sessions.add(sm);
    }
 else {
      MULTIPLE_SESSIONS_ARE_OPEN=true;
      if (FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ) {
        throw DBLogger.newFatal("String_Node_Str" + "String_Node_Str");
      }
    }
  }
  return sm.createSession(node,cache);
}

Fixed version (ground truth):
public static DiskAccessOneFile getSession(Node node,AbstractCache cache){
  String dbPath=node.getDbPath();
  LOGGER.info("String_Node_Str",dbPath);
  Path path=FileSystems.getDefault().getPath(dbPath);
  SessionManager sm=null;
synchronized (sessions) {
    try {
      for (      SessionManager smi : sessions) {
        if (Files.isSameFile(smi.getPath(),path)) {
          sm=smi;
          break;
        }
      }
    }
 catch (    IOException e) {
      throw DBLogger.newFatal("String_Node_Str" + dbPath,e);
    }
    if (sm == null) {
      sm=new SessionManager(path);
      sessions.add(sm);
    }
 else {
      MULTIPLE_SESSIONS_ARE_OPEN=true;
      if (FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ) {
        throw DBLogger.newFatal("String_Node_Str" + "String_Node_Str");
      }
    }
    return sm.createSession(node,cache);
  }
}
Program: 97972
Project: 97972
Buggy source:
void startWriting(long txId){
}

Fixed version (ground truth):
void startWriting(long txId){
  fsm.notifyBegin(txId);
}
Program: 97973
Project: 97973
Buggy source:
@Override public final void close(){
  flush();
  root.close(this);
}

Fixed version (ground truth):
@Override public final void close(){
  if (isClosed) {
    DBLogger.LOGGER.warn("String_Node_Str");
    return;
  }
  isClosed=true;
  flush();
  root.close(this);
}
Program: 97974
Project: 97974
Buggy source:
public void writeLock(T key){
  try {
    wSemaphore.acquire();
    if (currentWriterKey != NO_KEY) {
      throw new IllegalStateException();
    }
    rSemaphore.acquire(MAX_READERS);
    rSemaphore.release(MAX_READERS);
    currentWriterKey=key;
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void writeLock(T key){
  try {
    wSemaphore.acquire();
    if (currentWriterKey != NO_KEY) {
      throw new IllegalStateException();
    }
    rSemaphore.acquire(MAX_READERS);
    rSemaphore.release(MAX_READERS);
    currentWriterKey=key;
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new RuntimeException(e);
  }
}
Program: 97975
Project: 97975
Buggy source:
public void readLock(T key){
  try {
    wSemaphore.acquire();
    rSemaphore.acquire();
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
 finally {
    wSemaphore.release();
  }
}

Fixed version (ground truth):
public void readLock(T key){
  try {
    wSemaphore.acquire();
    rSemaphore.acquire();
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new RuntimeException(e);
  }
 finally {
    wSemaphore.release();
  }
}
Program: 97976
Project: 97976
Buggy source:
public Session(SessionParentCallback parentSession,String dbPath,SessionConfig config){
  if (dbPath == null || "String_Node_Str".equals(dbPath)) {
    throw DBLogger.newUser("String_Node_Str" + "String_Node_Str");
  }
  dbPath=ZooHelper.getDataStoreManager().getDbPath(dbPath);
  this.parentSession=parentSession;
  this.config=config;
  this.primary=ZooFactory.get().createNode(dbPath,this);
  this.cache=new ClientSessionCache(this);
  this.schemaManager=new SchemaManager(cache,config.getAutoCreateSchema());
  this.nodes.add(primary);
  this.cache.addNode(primary);
  this.primary.connect();
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("String_Node_Str",System.identityHashCode(this));
  }
}

Fixed version (ground truth):
public Session(SessionParentCallback parentSession,String dbPath,SessionConfig config){
  if (dbPath == null || "String_Node_Str".equals(dbPath)) {
    throw DBLogger.newUser("String_Node_Str" + "String_Node_Str");
  }
  dbPath=ZooHelper.getDataStoreManager().getDbPath(dbPath);
  this.parentSession=parentSession;
  this.config=config;
  this.primary=ZooFactory.get().createNode(dbPath,this);
  this.cache=new ClientSessionCache(this);
  this.schemaManager=new SchemaManager(cache,config.getAutoCreateSchema());
  this.nodes.add(primary);
  this.cache.addNode(primary);
  this.primary.connect();
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("String_Node_Str",System.identityHashCode(this));
  }
  unlock();
}
Program: 97977
Project: 97977
Buggy source:
public void enableLocking(boolean enable){
  isLockingEnabled=enable;
}

Fixed version (ground truth):
public void enableLocking(boolean enable){
  isLockingEnabled=enable;
  if (!enable && lock.isHeldByCurrentThread()) {
    lock.unlock();
  }
}
Program: 97978
Project: 97978
Buggy source:
@Override public Iterator<E> iterator(){
  try {
    lock.lock();
    boolean failOnClosedQuery=session.getConfig().getFailOnClosedQueries();
    if (!session.isActive() && !session.getConfig().getNonTransactionalRead()) {
      if (failOnClosedQuery) {
        session.checkOpen();
        session.checkActiveRead();
      }
 else {
        return new ClosableIteratorWrapper<>(failOnClosedQuery);
      }
    }
    ClosableIteratorWrapper<E> iter=new ClosableIteratorWrapper<>(c.iterator(),session,failOnClosedQuery);
    return new SynchronizedROIteratorC<E>(iter,lock,minIncl,maxExcl);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public Iterator<E> iterator(){
  try {
    lock.lock();
    boolean failOnClosedQuery=session.getConfig().getFailOnClosedQueries();
    if (!session.isActive() && !session.getConfig().getNonTransactionalRead()) {
      if (failOnClosedQuery) {
        session.checkOpen();
        session.checkActiveRead();
      }
 else {
        return new ClosableIteratorWrapper<>(failOnClosedQuery);
      }
    }
    ClosableIteratorWrapper<E> iter=new ClosableIteratorWrapper<>(c.iterator(),session,failOnClosedQuery);
    return new SynchronizedROIteratorC<>(iter,lock,minIncl,maxExcl);
  }
  finally {
    lock.unlock();
  }
}
Program: 97980
Project: 97980
Buggy source:
@Test public void test(){
  ZooJdoProperties props=TestTools.getProps();
  props.setZooAutoCreateSchema(true);
  PersistenceManager pm=TestTools.openPM(props);
  pm.currentTransaction().begin();
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  Query query=pm.newQuery(TestClass.class,"String_Node_Str");
  query.setOrdering("String_Node_Str");
  Object obj=query.execute();
  if (obj != null) {
    @SuppressWarnings("String_Node_Str") Collection<TestClass> books=(Collection<TestClass>)obj;
    for (    TestClass book : books)     System.out.println("String_Node_Str" + book.getInt() + "String_Node_Str");
  }
  query.closeAll();
  pm.currentTransaction().commit();
  if (pm.currentTransaction().isActive()) {
    pm.currentTransaction().rollback();
  }
  pm.close();
  pm.getPersistenceManagerFactory().close();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private void test(boolean withData){
  ZooJdoProperties props=TestTools.getProps();
  props.setZooAutoCreateSchema(true);
  PersistenceManager pm=TestTools.openPM(props);
  pm.currentTransaction().begin();
  if (withData) {
    TestClass book3=new TestClass();
    book3.setInt(3);
    pm.makePersistent(book3);
    TestClass book20=new TestClass();
    book20.setInt(20);
    pm.makePersistent(book20);
  }
  pm.currentTransaction().commit();
  pm.currentTransaction().begin();
  Query query=pm.newQuery(TestClass.class,"String_Node_Str");
  query.setOrdering("String_Node_Str");
  Object obj=query.execute();
  if (obj != null) {
    @SuppressWarnings("String_Node_Str") Collection<TestClass> books=(Collection<TestClass>)obj;
    for (    TestClass book : books) {
      assertTrue(0 < book.getInt());
    }
  }
  query.closeAll();
  pm.currentTransaction().commit();
  if (pm.currentTransaction().isActive()) {
    pm.currentTransaction().rollback();
  }
  pm.close();
  pm.getPersistenceManagerFactory().close();
}
Program: 97981
Project: 97981
Buggy source:
@Override public void close(Object queryResult){
  if (!queryResults.remove(queryResult)) {
    LOGGER.warn("String_Node_Str");
    return;
  }
  if (queryResult instanceof ExtentAdaptor) {
    ((ExtentAdaptor<?>)queryResult).closeAll();
  }
 else   if (queryResult instanceof ExtentImpl) {
    ((ExtentImpl<?>)queryResult).closeAll();
  }
 else {
    LOGGER.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void close(Object queryResult){
  if (!queryResults.remove(queryResult)) {
    return;
  }
  if (queryResult instanceof ExtentAdaptor) {
    ((ExtentAdaptor<?>)queryResult).closeAll();
  }
 else   if (queryResult instanceof ExtentImpl) {
    ((ExtentImpl<?>)queryResult).closeAll();
  }
 else {
    LOGGER.warn("String_Node_Str");
  }
}
Program: 97982
Project: 97982
Buggy source:
DiskAccessOneFile(Node node,AbstractCache cache,SessionManager sm){
  this.sm=sm;
  this.node=node;
  this.cache=cache;
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.readLock(this);
  this.freeIndex=sm.getFsm();
  this.file=sm.getFile().createChannel();
  oidIndex=sm.getOidIndex();
  schemaIndex=sm.getSchemaIndex();
  objectReader=new ObjectReader(file);
  ddsPool=new PoolDDS(file,this.cache);
  fileInAP=file.getReader(true);
}

Fixed version (ground truth):
DiskAccessOneFile(Node node,AbstractCache cache,SessionManager sm){
  this.sm=sm;
  this.node=node;
  this.cache=cache;
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  this.freeIndex=sm.getFsm();
  this.file=sm.getFile().createChannel();
  oidIndex=sm.getOidIndex();
  schemaIndex=sm.getSchemaIndex();
  objectReader=new ObjectReader(file);
  ddsPool=new PoolDDS(file,this.cache);
  fileInAP=file.getReader(true);
}
Program: 97983
Project: 97983
Buggy source:
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.newTransaction(txId);
  freeIndex.notifyBegin(txId);
  return ovr;
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.newTransaction(txId);
  sm.getFsm().getFile().newTransaction(txId);
  freeIndex.notifyBegin(txId);
  return ovr;
}
Program: 97984
Project: 97984
Buggy source:
@Override public void newTransaction(long txId){
  this.txId=txId;
  root.newTransaction(txId);
}

Fixed version (ground truth):
@Override public void newTransaction(long txId){
  this.txId=txId;
}
Program: 97985
Project: 97985
Buggy source:
@Test public void testFailureReport(){
  TestTools.openPM();
  try {
    ZooDebug.closeOpenFiles();
    fail();
  }
 catch (  IllegalStateException e) {
  }
}

Fixed version (ground truth):
@Test public void testFailureReport(){
  TestTools.openPM();
  try {
    ZooDebug.closeOpenFiles();
    fail();
  }
 catch (  IllegalStateException e) {
  }
  TestTools.closePM();
}
Program: 97986
Project: 97986
Buggy source:
@Override public OptimisticTransactionResult checkTxConsistency(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.getLock().release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.getLock().readLock(this);
  }
 else {
    sm.getLock().writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,true);
  if (ovr.hasFailed()) {
    return ovr;
  }
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.getLock().release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.getLock().readLock(this);
  }
 else {
    sm.getLock().writeLock(this);
  }
  return ovr;
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult checkTxConsistency(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,true);
  if (ovr.hasFailed()) {
    return ovr;
  }
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  return ovr;
}
Program: 97987
Project: 97987
Buggy source:
@Override public OptimisticTransactionResult rollbackTransaction(){
  try {
    OptimisticTransactionResult txr=new OptimisticTransactionResult(null,false,false);
    if (txContext.getSchemaIndexTxId() != schemaIndex.getTxIdOfLastWriteThatRequiresRefresh()) {
      txr.setRefreshRequired(true);
    }
    if (txContext.getSchemaTxId() != schemaIndex.getTxIdOfLastWrite()) {
      txr.setResetRequired(true);
    }
    txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
    txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
    return txr;
  }
  finally {
    LOGGER.info(LOCKING_MARKER,"String_Node_Str");
    sm.getLock().release(this);
  }
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult rollbackTransaction(){
  try {
    OptimisticTransactionResult txr=new OptimisticTransactionResult(null,false,false);
    if (txContext.getSchemaIndexTxId() != schemaIndex.getTxIdOfLastWriteThatRequiresRefresh()) {
      txr.setRefreshRequired(true);
    }
    if (txContext.getSchemaTxId() != schemaIndex.getTxIdOfLastWrite()) {
      txr.setResetRequired(true);
    }
    txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
    txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
    return txr;
  }
  finally {
    LOGGER.info(LOCKING_MARKER,"String_Node_Str");
    sm.release(this);
  }
}
Program: 97988
Project: 97988
Buggy source:
@Override public void commit(){
  int oidPage=oidIndex.write();
  int schemaPage1=schemaIndex.write(txId);
  txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
  txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
  sm.commitInfrastructure(oidPage,schemaPage1,oidIndex.getLastUsedOid(),txId);
  txContext.reset();
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.getLock().release(this);
}

Fixed version (ground truth):
@Override public void commit(){
  int oidPage=oidIndex.write();
  int schemaPage1=schemaIndex.write(txId);
  txContext.setSchemaTxId(schemaIndex.getTxIdOfLastWrite());
  txContext.setSchemaIndexTxId(schemaIndex.getTxIdOfLastWriteThatRequiresRefresh());
  sm.commitInfrastructure(oidPage,schemaPage1,oidIndex.getLastUsedOid(),txId);
  txContext.reset();
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
}
Program: 97989
Project: 97989
Buggy source:
@Override public void close(){
  LOGGER.info("String_Node_Str",node.getDbPath());
  sm.close();
}

Fixed version (ground truth):
@Override public void close(){
  LOGGER.info("String_Node_Str",node.getDbPath());
  try {
    sm.writeLock(this);
    sm.close();
  }
  finally {
    LOGGER.info(LOCKING_MARKER,"String_Node_Str");
    sm.release(this);
  }
}
Program: 97990
Project: 97990
Buggy source:
DiskAccessOneFile(Node node,AbstractCache cache,SessionManager sm){
  this.sm=sm;
  this.node=node;
  this.cache=cache;
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.getLock().readLock(this);
  this.freeIndex=sm.getFsm();
  this.file=sm.getFile();
  oidIndex=sm.getOidIndex();
  schemaIndex=sm.getSchemaIndex();
  objectReader=new ObjectReader(file);
  ddsPool=new PoolDDS(file,this.cache);
  fileInAP=file.getReader(true);
}

Fixed version (ground truth):
DiskAccessOneFile(Node node,AbstractCache cache,SessionManager sm){
  this.sm=sm;
  this.node=node;
  this.cache=cache;
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.writeLock(this);
  this.freeIndex=sm.getFsm();
  this.file=sm.getFile();
  oidIndex=sm.getOidIndex();
  schemaIndex=sm.getSchemaIndex();
  objectReader=new ObjectReader(file);
  ddsPool=new PoolDDS(file,this.cache);
  fileInAP=file.getReader(true);
}
Program: 97991
Project: 97991
Buggy source:
@Override public long beginTransaction(){
  txContext.reset();
  if (ALLOW_READ_CONCURRENCY) {
    sm.getLock().readLock(this);
  }
 else {
    sm.getLock().writeLock(this);
  }
  txId=sm.getNextTxId();
  return txId;
}

Fixed version (ground truth):
@Override public long beginTransaction(){
  txContext.reset();
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  txId=sm.getNextTxId();
  return txId;
}
Program: 97992
Project: 97992
Buggy source:
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.getLock().release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.getLock().readLock(this);
  }
 else {
    sm.getLock().writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.newTransaction(txId);
  freeIndex.notifyBegin(txId);
  return ovr;
}

Fixed version (ground truth):
@Override public OptimisticTransactionResult beginCommit(ArrayList<TxObjInfo> updates){
  LOGGER.info(LOCKING_MARKER,"String_Node_Str");
  sm.release(this);
  if (ALLOW_READ_CONCURRENCY) {
    sm.readLock(this);
  }
 else {
    sm.writeLock(this);
  }
  OptimisticTransactionResult ovr=checkConsistencyInternal(updates,false);
  if (ovr.hasFailed()) {
    return ovr;
  }
  file.newTransaction(txId);
  freeIndex.notifyBegin(txId);
  return ovr;
}
Program: 97993
Project: 97993
Buggy source:
static synchronized void removeSession(SessionManager sm){
  if (!sessions.remove(sm)) {
    throw DBLogger.newFatalInternal("String_Node_Str" + sm.getPath());
  }
  if (sessions.size() <= 1) {
    MULTIPLE_SESSIONS_ARE_OPEN=false;
  }
  if (sessions.isEmpty()) {
    FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
  }
}

Fixed version (ground truth):
static void removeSession(SessionManager sm){
synchronized (sessions) {
    if (!sessions.remove(sm)) {
      throw DBLogger.newFatalInternal("String_Node_Str" + sm.getPath());
    }
    if (sessions.size() <= 1) {
      MULTIPLE_SESSIONS_ARE_OPEN=false;
    }
    if (sessions.isEmpty()) {
      FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
    }
  }
}
Program: 97994
Project: 97994
Buggy source:
public static synchronized void cleanUp(File dbFile){
  Path path=dbFile.toPath();
  try {
    for (    SessionManager smi : sessions) {
      if (Files.isSameFile(smi.getPath(),path)) {
        if (smi.isLocked() && !IGNORE_OPEN_SESSIONS) {
          throw DBLogger.newUser("String_Node_Str" + dbFile);
        }
        sessions.remove(smi);
        break;
      }
    }
    FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
    MULTIPLE_SESSIONS_ARE_OPEN=false;
  }
 catch (  IOException e) {
    throw DBLogger.newFatal("String_Node_Str" + dbFile,e);
  }
}

Fixed version (ground truth):
public static void cleanUp(File dbFile){
  Path path=dbFile.toPath();
  try {
synchronized (sessions) {
      for (      SessionManager smi : sessions) {
        if (Files.isSameFile(smi.getPath(),path)) {
          if (smi.isLocked() && !IGNORE_OPEN_SESSIONS) {
            throw DBLogger.newUser("String_Node_Str" + dbFile);
          }
          sessions.remove(smi);
          break;
        }
      }
      FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
      MULTIPLE_SESSIONS_ARE_OPEN=false;
    }
  }
 catch (  IOException e) {
    throw DBLogger.newFatal("String_Node_Str" + dbFile,e);
  }
}
Program: 97995
Project: 97995
Buggy source:
public synchronized static void clear(){
  sessions.clear();
  FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
  MULTIPLE_SESSIONS_ARE_OPEN=false;
}

Fixed version (ground truth):
public static void clear(){
synchronized (sessions) {
    sessions.clear();
    FAIL_BECAUSE_OF_ACTIVE_NON_TX_READ=false;
    MULTIPLE_SESSIONS_ARE_OPEN=false;
  }
}