nus-yam/ex-repair huggingface dataset:
Program: 155153
Project: 155153
Buggy source:
public BatchInserter(String storeDir,Map<String,String> stringParams){
  Map<Object,Object> params=getDefaultParams();
  for (  Map.Entry<String,String> entry : stringParams.entrySet()) {
    params.put(entry.getKey(),entry.getValue());
  }
  this.storeDir=storeDir;
  Map<Object,Object> config=getDefaultParams();
  String store=fixPath(storeDir);
  config.put("String_Node_Str",store);
  neoStore=new NeoStore(config);
  neoStore.makeStoreOk();
  PropertyIndexData[] indexes=getPropertyIndexStore().getPropertyIndexes(10000);
  indexHolder=new PropertyIndexHolder(indexes);
  RelationshipTypeData[] types=getRelationshipTypeStore().getRelationshipTypes();
  typeHolder=new RelationshipTypeHolder(types);
}

Fixed version (ground truth):
public BatchInserter(String storeDir,Map<String,String> stringParams){
  Map<Object,Object> params=getDefaultParams();
  for (  Map.Entry<String,String> entry : stringParams.entrySet()) {
    params.put(entry.getKey(),entry.getValue());
  }
  this.storeDir=storeDir;
  String store=fixPath(storeDir);
  params.put("String_Node_Str",store);
  neoStore=new NeoStore(params);
  neoStore.makeStoreOk();
  PropertyIndexData[] indexes=getPropertyIndexStore().getPropertyIndexes(10000);
  indexHolder=new PropertyIndexHolder(indexes);
  RelationshipTypeData[] types=getRelationshipTypeStore().getRelationshipTypes();
  typeHolder=new RelationshipTypeHolder(types);
}
Program: 155154
Project: 155154
Buggy source:
private void dumpStatus(){
  try {
    log.finest("String_Node_Str" + storeName + "String_Node_Str"+ brickCount+ "String_Node_Str"+ brickSize+ "String_Node_Str"+ mappedMem+ "String_Node_Str"+ fileChannel.size()+ "String_Node_Str");
  }
 catch (  IOException e) {
    throw new StoreFailureException("String_Node_Str" + storeName,e);
  }
}

Fixed version (ground truth):
private void dumpStatus(){
  try {
    log.fine("String_Node_Str" + storeName + "String_Node_Str"+ brickCount+ "String_Node_Str"+ brickSize+ "String_Node_Str"+ mappedMem+ "String_Node_Str"+ fileChannel.size()+ "String_Node_Str");
  }
 catch (  IOException e) {
    throw new StoreFailureException("String_Node_Str" + storeName,e);
  }
}
Program: 155155
Project: 155155
Buggy source:
private LockableWindow allocateNewWindow(long brick){
  if (!useDirect) {
    return new MappedPersistenceWindow(brick * brickSize / blockSize,blockSize,brickSize,fileChannel);
  }
  DirectPersistenceWindow dpw=new DirectPersistenceWindow(brick * brickSize / blockSize,blockSize,brickSize,fileChannel);
  dpw.readPosition();
  return dpw;
}

Fixed version (ground truth):
private LockableWindow allocateNewWindow(long brick){
  if (useMemoryMapped) {
    return new MappedPersistenceWindow(brick * brickSize / blockSize,blockSize,brickSize,fileChannel);
  }
  DirectPersistenceWindow dpw=new DirectPersistenceWindow(brick * brickSize / blockSize,blockSize,brickSize,fileChannel);
  dpw.readPosition();
  return dpw;
}
Program: 155162
Project: 155162
Buggy source:
private Map<String,Object> getPropertyChain(int propertyId){
  PropertyStore propStore=getPropertyStore();
  PropertyRecord propertyRecord=propStore.getRecord(propertyId);
  int nextProperty=propertyRecord.getNextProp();
  Map<String,Object> properties=new HashMap<String,Object>();
  do {
    propStore.makeHeavy(propertyRecord);
    String key=indexHolder.getStringKey(propertyRecord.getKeyIndexId());
    Object value=propStore.getValue(propertyRecord);
    properties.put(key,value);
    if (nextProperty != Record.NO_NEXT_PROPERTY.intValue()) {
      propertyRecord=propStore.getRecord(propertyRecord.getNextProp());
    }
  }
 while (nextProperty != Record.NO_NEXT_PROPERTY.intValue());
  return properties;
}

Fixed version (ground truth):
private Map<String,Object> getPropertyChain(int propertyId){
  PropertyStore propStore=getPropertyStore();
  PropertyRecord propertyRecord=propStore.getRecord(propertyId);
  int nextProperty=-1;
  Map<String,Object> properties=new HashMap<String,Object>();
  do {
    nextProperty=propertyRecord.getNextProp();
    propStore.makeHeavy(propertyRecord);
    String key=indexHolder.getStringKey(propertyRecord.getKeyIndexId());
    Object value=propStore.getValue(propertyRecord);
    properties.put(key,value);
    if (nextProperty != Record.NO_NEXT_PROPERTY.intValue()) {
      propertyRecord=propStore.getRecord(propertyRecord.getNextProp());
    }
  }
 while (nextProperty != Record.NO_NEXT_PROPERTY.intValue());
  return properties;
}
Program: 155163
Project: 155163
Buggy source:
public static IntArray composeNew(IntArray src,IntArray add,IntArray remove){
  if (remove == null) {
    if (src == null) {
      return add;
    }
    if (add != null) {
      IntArray newArray=new IntArray(add.length() + src.length());
      newArray.addAll(src);
      newArray.addAll(add);
      return newArray;
    }
    return src;
  }
 else {
    if (src == null && add == null) {
      return null;
    }
    int newLength=0;
    if (add != null) {
      newLength+=add.length();
    }
    if (src != null) {
      newLength+=src.length();
    }
    IntArray newArray=new IntArray(newLength);
    Set<Integer> set=new HashSet<Integer>(remove.length() + 1,1.0f);
    for (int i=0; i < remove.length(); i++) {
      set.add(remove.get(i));
    }
    newArray.addAll(src);
    for (int i=0; i < newArray.length(); i++) {
      int value=newArray.get(i);
      if (set.contains(value)) {
        boolean swapSuccessful=false;
        for (int j=newArray.length() - 1; j > i + 1; j--) {
          int backValue=newArray.get(j);
          newArray.arrayCount--;
          if (!set.contains(backValue)) {
            newArray.getArray()[i]=backValue;
            swapSuccessful=true;
            break;
          }
        }
        if (!swapSuccessful) {
          newArray.arrayCount--;
        }
      }
    }
    if (add != null) {
      for (int i=0; i < add.length(); i++) {
        int value=add.get(i);
        if (!set.contains(value)) {
          newArray.add(value);
        }
      }
    }
    return newArray;
  }
}

Fixed version (ground truth):
public static IntArray composeNew(IntArray src,IntArray add,IntArray remove){
  if (remove == null) {
    if (src == null) {
      return add;
    }
    if (add != null) {
      IntArray newArray=new IntArray(add.length() + src.length());
      newArray.addAll(src);
      newArray.addAll(add);
      return newArray;
    }
    return src;
  }
 else {
    if (src == null && add == null) {
      return null;
    }
    int newLength=0;
    if (add != null) {
      newLength+=add.length();
    }
    if (src != null) {
      newLength+=src.length();
    }
    IntArray newArray=new IntArray(newLength);
    Set<Integer> set=new HashSet<Integer>(remove.length() + 1,1.0f);
    for (int i=0; i < remove.length(); i++) {
      set.add(remove.get(i));
    }
    newArray.addAll(src);
    for (int i=0; i < newArray.length(); i++) {
      int value=newArray.get(i);
      if (set.contains(value)) {
        boolean swapSuccessful=false;
        for (int j=newArray.length() - 1; j >= i + 1; j--) {
          int backValue=newArray.get(j);
          newArray.arrayCount--;
          if (!set.contains(backValue)) {
            newArray.getArray()[i]=backValue;
            swapSuccessful=true;
            break;
          }
        }
        if (!swapSuccessful) {
          newArray.arrayCount--;
        }
      }
    }
    if (add != null) {
      for (int i=0; i < add.length(); i++) {
        int value=add.get(i);
        if (!set.contains(value)) {
          newArray.add(value);
        }
      }
    }
    return newArray;
  }
}
Program: 155164
Project: 155164
Buggy source:
public void testSimple3(){
  Node node1=getNeo().createNode();
  Node node2=getNeo().createNode();
  for (int i=0; i < 1; i++) {
    node1.createRelationshipTo(node2,MyRelTypes.TEST);
    node1.createRelationshipTo(node2,MyRelTypes.TEST_TRAVERSAL);
    node1.createRelationshipTo(node2,MyRelTypes.TEST2);
  }
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  newTransaction();
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  node1.getRelationships(MyRelTypes.TEST,Direction.OUTGOING).iterator().next().delete();
  node1.getRelationships(MyRelTypes.TEST_TRAVERSAL,Direction.OUTGOING).iterator().next().delete();
  node1.getRelationships(MyRelTypes.TEST2,Direction.OUTGOING).iterator().next().delete();
  node1.createRelationshipTo(node2,MyRelTypes.TEST);
  node1.createRelationshipTo(node2,MyRelTypes.TEST_TRAVERSAL);
  node1.createRelationshipTo(node2,MyRelTypes.TEST2);
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  newTransaction();
  Node node3=getNeo().createNode();
  Node node4=getNeo().createNode();
  for (int i=0; i < 10000; i++) {
    node3.createRelationshipTo(node4,MyRelTypes.TEST);
  }
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  for (  Relationship rel : node1.getRelationships()) {
    rel.delete();
  }
  node1.delete();
  node2.delete();
}

Fixed version (ground truth):
public void testSimple3(){
  Node node1=getNeo().createNode();
  Node node2=getNeo().createNode();
  for (int i=0; i < 1; i++) {
    node1.createRelationshipTo(node2,MyRelTypes.TEST);
    node1.createRelationshipTo(node2,MyRelTypes.TEST_TRAVERSAL);
    node1.createRelationshipTo(node2,MyRelTypes.TEST2);
  }
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  newTransaction();
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  node1.getRelationships(MyRelTypes.TEST,Direction.OUTGOING).iterator().next().delete();
  node1.getRelationships(MyRelTypes.TEST_TRAVERSAL,Direction.OUTGOING).iterator().next().delete();
  node1.getRelationships(MyRelTypes.TEST2,Direction.OUTGOING).iterator().next().delete();
  node1.createRelationshipTo(node2,MyRelTypes.TEST);
  node1.createRelationshipTo(node2,MyRelTypes.TEST_TRAVERSAL);
  node1.createRelationshipTo(node2,MyRelTypes.TEST2);
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  newTransaction();
  allGetRelationshipMethods2(node1,Direction.OUTGOING);
  allGetRelationshipMethods2(node2,Direction.INCOMING);
  for (  Relationship rel : node1.getRelationships()) {
    rel.delete();
  }
  node1.delete();
  node2.delete();
}
Program: 155165
Project: 155165
Buggy source:
public RelationshipData[] nodeGetRelationships(int nodeId){
  NodeRecord nodeRecord=getNodeRecord(nodeId);
  if (nodeRecord == null) {
    nodeRecord=getNodeStore().getRecord(nodeId);
  }
 else {
    if (!nodeRecord.inUse()) {
      throw new StoreFailureException("String_Node_Str" + nodeId + "String_Node_Str");
    }
  }
  int nextRel=nodeRecord.getNextRel();
  List<RelationshipData> rels=new ArrayList<RelationshipData>();
  while (nextRel != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord relRecord=getRelationshipRecord(nextRel);
    if (relRecord == null) {
      relRecord=getRelationshipStore().getRecord(nextRel);
    }
    int firstNode=relRecord.getFirstNode();
    int secondNode=relRecord.getSecondNode();
    rels.add(new RelationshipData(nextRel,firstNode,secondNode,relRecord.getType()));
    if (firstNode == nodeId) {
      nextRel=relRecord.getFirstNextRel();
    }
 else     if (secondNode == nodeId) {
      nextRel=relRecord.getSecondNextRel();
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
  return rels.toArray(new RelationshipData[rels.size()]);
}

Fixed version (ground truth):
public RelationshipData[] nodeGetRelationships(int nodeId){
  NodeRecord nodeRecord=getNodeRecord(nodeId);
  if (nodeRecord == null) {
    nodeRecord=getNodeStore().getRecord(nodeId);
  }
 else {
    if (!nodeRecord.inUse()) {
      throw new StoreFailureException("String_Node_Str" + nodeId + "String_Node_Str");
    }
  }
  int nextRel=nodeRecord.getNextRel();
  List<RelationshipData> rels=new ArrayList<RelationshipData>();
  while (nextRel != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord relRecord=getRelationshipRecord(nextRel);
    if (relRecord == null) {
      relRecord=getRelationshipStore().getRecord(nextRel);
    }
    int firstNode=relRecord.getFirstNode();
    int secondNode=relRecord.getSecondNode();
    if (!relRecord.isCreated()) {
      rels.add(new RelationshipData(nextRel,firstNode,secondNode,relRecord.getType()));
    }
    if (firstNode == nodeId) {
      nextRel=relRecord.getFirstNextRel();
    }
 else     if (secondNode == nodeId) {
      nextRel=relRecord.getSecondNextRel();
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
  return rels.toArray(new RelationshipData[rels.size()]);
}
Program: 155166
Project: 155166
Buggy source:
public PropertyData[] relGetProperties(int relId){
  RelationshipRecord relRecord=getRelationshipRecord(relId);
  if (relRecord == null) {
    relRecord=getRelationshipStore().getRecord(relId);
  }
  if (!relRecord.inUse()) {
    throw new StoreFailureException("String_Node_Str" + relId + "String_Node_Str");
  }
  int nextProp=relRecord.getNextProp();
  List<PropertyData> properties=new ArrayList<PropertyData>();
  while (nextProp != Record.NO_NEXT_PROPERTY.intValue()) {
    PropertyRecord propRecord=getPropertyRecord(nextProp);
    if (propRecord == null) {
      propRecord=getPropertyStore().getLightRecord(nextProp);
    }
    properties.add(new PropertyData(propRecord.getId(),propRecord.getKeyIndexId(),propertyGetValueOrNull(propRecord)));
    nextProp=propRecord.getNextProp();
  }
  return properties.toArray(new PropertyData[properties.size()]);
}

Fixed version (ground truth):
public PropertyData[] relGetProperties(int relId){
  RelationshipRecord relRecord=getRelationshipRecord(relId);
  if (relRecord == null) {
    relRecord=getRelationshipStore().getRecord(relId);
  }
  if (!relRecord.inUse()) {
    throw new StoreFailureException("String_Node_Str" + relId + "String_Node_Str");
  }
  int nextProp=relRecord.getNextProp();
  List<PropertyData> properties=new ArrayList<PropertyData>();
  while (nextProp != Record.NO_NEXT_PROPERTY.intValue()) {
    PropertyRecord propRecord=getPropertyRecord(nextProp);
    if (propRecord == null) {
      propRecord=getPropertyStore().getLightRecord(nextProp);
    }
    if (!propRecord.isCreated()) {
      properties.add(new PropertyData(propRecord.getId(),propRecord.getKeyIndexId(),propertyGetValueOrNull(propRecord)));
    }
    nextProp=propRecord.getNextProp();
  }
  return properties.toArray(new PropertyData[properties.size()]);
}
Program: 155167
Project: 155167
Buggy source:
public PropertyData[] nodeGetProperties(int nodeId){
  NodeRecord nodeRecord=getNodeRecord(nodeId);
  if (nodeRecord == null) {
    nodeRecord=getNodeStore().getRecord(nodeId);
  }
 else   if (!nodeRecord.inUse()) {
    throw new StoreFailureException("String_Node_Str" + nodeId + "String_Node_Str");
  }
  int nextProp=nodeRecord.getNextProp();
  List<PropertyData> properties=new ArrayList<PropertyData>();
  while (nextProp != Record.NO_NEXT_PROPERTY.intValue()) {
    PropertyRecord propRecord=getPropertyRecord(nextProp);
    if (propRecord == null) {
      propRecord=getPropertyStore().getLightRecord(nextProp);
    }
    properties.add(new PropertyData(propRecord.getId(),propRecord.getKeyIndexId(),propertyGetValueOrNull(propRecord)));
    nextProp=propRecord.getNextProp();
  }
  return properties.toArray(new PropertyData[properties.size()]);
}

Fixed version (ground truth):
public PropertyData[] nodeGetProperties(int nodeId){
  NodeRecord nodeRecord=getNodeRecord(nodeId);
  if (nodeRecord == null) {
    nodeRecord=getNodeStore().getRecord(nodeId);
  }
 else   if (!nodeRecord.inUse()) {
    throw new StoreFailureException("String_Node_Str" + nodeId + "String_Node_Str");
  }
  int nextProp=nodeRecord.getNextProp();
  List<PropertyData> properties=new ArrayList<PropertyData>();
  while (nextProp != Record.NO_NEXT_PROPERTY.intValue()) {
    PropertyRecord propRecord=getPropertyRecord(nextProp);
    if (propRecord == null) {
      propRecord=getPropertyStore().getLightRecord(nextProp);
    }
    if (!propRecord.isCreated()) {
      properties.add(new PropertyData(propRecord.getId(),propRecord.getKeyIndexId(),propertyGetValueOrNull(propRecord)));
    }
    nextProp=propRecord.getNextProp();
  }
  return properties.toArray(new PropertyData[properties.size()]);
}
Program: 155169
Project: 155169
Buggy source:
public String readLine(){
  try {
    grabAvailableCommands();
    return (String)consoleReader.getClass().getMethod("String_Node_Str").invoke(consoleReader);
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public String readLine(){
  try {
    grabAvailableCommands();
    successfulGrabAvailableCommands=true;
  }
 catch (  Exception e) {
    if (successfulGrabAvailableCommands) {
      System.err.println("String_Node_Str" + e.toString());
      successfulGrabAvailableCommands=false;
    }
  }
  try {
    return (String)consoleReader.getClass().getMethod("String_Node_Str").invoke(consoleReader);
  }
 catch (  RuntimeException e) {
    throw e;
  }
catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 155170
Project: 155170
Buggy source:
/** 
 * @return the next line read from the console (user input).
 */
public String readLine(){
  try {
    StringBuffer text=new StringBuffer();
    while (true) {
      int charRead=System.in.read();
      if (charRead == '\r' || charRead == '\n') {
        System.in.skip(System.in.available());
        break;
      }
      text.append((char)charRead);
    }
    return text.toString();
  }
 catch (  java.io.IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * @return the next line read from the console (user input).
 */
public String readLine(){
  try {
    if (consoleReader == null) {
      consoleReader=new BufferedReader(new InputStreamReader(System.in));
    }
    return consoleReader.readLine();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 155171
Project: 155171
Buggy source:
public void recoveryComplete(){
  logger.info("String_Node_Str" + "String_Node_Str");
  logger.info("String_Node_Str" + "String_Node_Str");
  neoStore.makeStoreOk();
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public void recoveryComplete(){
  logger.fine("String_Node_Str" + "String_Node_Str");
  logger.fine("String_Node_Str" + "String_Node_Str");
  neoStore.makeStoreOk();
  logger.fine("String_Node_Str");
}
Program: 155172
Project: 155172
Buggy source:
/** 
 * Creates a data source with minimum (no memory mapped) configuration.
 * @param neoStoreFileName The file name of the neo store
 * @param logicalLogPath The file name of the logical log
 * @throws IOException If unable to open store
 */
public NeoStoreXaDataSource(String neoStoreFileName,String logicalLogPath,LockManager lockManager,LockReleaser lockReleaser) throws IOException, InstantiationException {
  super(null);
  this.lockManager=lockManager;
  this.lockReleaser=lockReleaser;
  storeDir=logicalLogPath;
  neoStore=new NeoStore(neoStoreFileName);
  xaContainer=XaContainer.create(logicalLogPath,new CommandFactory(neoStore),new TransactionFactory());
  xaContainer.openLogicalLog();
  if (!xaContainer.getResourceManager().hasRecoveredTransactions()) {
    neoStore.makeStoreOk();
  }
 else {
    logger.info("String_Node_Str");
  }
  idGenerators=new ArrayMap<Class<?>,Store>(5,false,false);
  this.idGenerators.put(Node.class,neoStore.getNodeStore());
  this.idGenerators.put(Relationship.class,neoStore.getRelationshipStore());
  this.idGenerators.put(RelationshipType.class,neoStore.getRelationshipTypeStore());
  this.idGenerators.put(PropertyStore.class,neoStore.getPropertyStore());
  this.idGenerators.put(PropertyIndex.class,neoStore.getPropertyStore().getIndexStore());
}

Fixed version (ground truth):
/** 
 * Creates a data source with minimum (no memory mapped) configuration.
 * @param neoStoreFileName The file name of the neo store
 * @param logicalLogPath The file name of the logical log
 * @throws IOException If unable to open store
 */
public NeoStoreXaDataSource(String neoStoreFileName,String logicalLogPath,LockManager lockManager,LockReleaser lockReleaser) throws IOException, InstantiationException {
  super(null);
  this.lockManager=lockManager;
  this.lockReleaser=lockReleaser;
  storeDir=logicalLogPath;
  neoStore=new NeoStore(neoStoreFileName);
  xaContainer=XaContainer.create(logicalLogPath,new CommandFactory(neoStore),new TransactionFactory());
  xaContainer.openLogicalLog();
  if (!xaContainer.getResourceManager().hasRecoveredTransactions()) {
    neoStore.makeStoreOk();
  }
 else {
    logger.info("String_Node_Str" + "String_Node_Str");
  }
  idGenerators=new ArrayMap<Class<?>,Store>(5,false,false);
  this.idGenerators.put(Node.class,neoStore.getNodeStore());
  this.idGenerators.put(Relationship.class,neoStore.getRelationshipStore());
  this.idGenerators.put(RelationshipType.class,neoStore.getRelationshipTypeStore());
  this.idGenerators.put(PropertyStore.class,neoStore.getPropertyStore());
  this.idGenerators.put(PropertyIndex.class,neoStore.getPropertyStore().getIndexStore());
}
Program: 155175
Project: 155175
Buggy source:
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str"+ "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=new File(logFileName).renameTo(new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  while (readEntry()) {
    logEntriesFound++;
  }
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  log.info("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() > 0) {
    log.info("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.info("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}

Fixed version (ground truth):
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=new File(logFileName).renameTo(new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  while (readEntry()) {
    logEntriesFound++;
  }
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() == 0) {
    log.fine("String_Node_Str");
  }
 else {
    log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}
Program: 155176
Project: 155176
Buggy source:
public synchronized void close() throws IOException {
  if (fileChannel == null || !fileChannel.isOpen()) {
    log.info("String_Node_Str" + fileName + "String_Node_Str");
    return;
  }
  long endPosition=writeBuffer.getFileChannelPosition();
  if (xidIdentMap.size() > 0) {
    log.info("String_Node_Str" + xidIdentMap.size());
    log.info("String_Node_Str" + fileName + "String_Node_Str"+ currentLog);
    if (writeBuffer != null) {
      writeBuffer.force();
    }
    writeBuffer=null;
    fileChannel.close();
    return;
  }
  if (!keepLogs || backupSlave) {
    if (currentLog == CLEAN) {
      deleteCurrentLogFile(fileName);
    }
 else {
      deleteCurrentLogFile(fileName + "String_Node_Str" + currentLog);
    }
  }
 else {
    renameCurrentLogFileAndIncrementVersion(fileName + "String_Node_Str" + currentLog,endPosition);
  }
  if (currentLog != CLEAN) {
    setActiveLog(CLEAN);
  }
}

Fixed version (ground truth):
public synchronized void close() throws IOException {
  if (fileChannel == null || !fileChannel.isOpen()) {
    log.info("String_Node_Str" + fileName + "String_Node_Str");
    return;
  }
  long endPosition=writeBuffer.getFileChannelPosition();
  if (xidIdentMap.size() > 0) {
    log.info("String_Node_Str" + xidIdentMap.size() + "String_Node_Str");
    if (writeBuffer != null) {
      writeBuffer.force();
    }
    writeBuffer=null;
    fileChannel.close();
    log.info("String_Node_Str" + fileName + "String_Node_Str"+ currentLog+ "String_Node_Str"+ "String_Node_Str");
    return;
  }
  if (!keepLogs || backupSlave) {
    if (currentLog == CLEAN) {
      deleteCurrentLogFile(fileName);
    }
 else {
      deleteCurrentLogFile(fileName + "String_Node_Str" + currentLog);
    }
  }
 else {
    renameCurrentLogFileAndIncrementVersion(fileName + "String_Node_Str" + currentLog,endPosition);
  }
  if (currentLog != CLEAN) {
    setActiveLog(CLEAN);
  }
}
Program: 155178
Project: 155178
Buggy source:
private Node traverseToNextNode(){
  Node nodeToReturn=null;
  while (!this.listIsEmpty() && nodeToReturn == null) {
    TraversalPositionImpl currentPos=this.getNextPositionFromList();
    traversalPosition=currentPos;
    Node currentNode=currentPos.currentNode();
    if (visitedNodes.add(currentNode)) {
      currentPos.setReturnedNodesCount(this.returnedNodesCount);
      try {
        if (!this.stopEvaluator.isStopNode(currentPos)) {
          this.addEndNodesToList(currentPos,this.traversableRels,this.traversableDirs);
          this.addEndNodesToList(currentPos,this.preservingRels,this.preservingDirs);
        }
        if (this.returnableEvaluator.isReturnableNode(currentPos)) {
          this.returnedNodesCount++;
          nodeToReturn=currentPos.currentNode();
        }
      }
 catch (      NotFoundException e) {
      }
    }
  }
  return nodeToReturn;
}

Fixed version (ground truth):
private Node traverseToNextNode(){
  Node nodeToReturn=null;
  while (!this.listIsEmpty() && nodeToReturn == null) {
    TraversalPositionImpl currentPos=this.getNextPositionFromList();
    traversalPosition=currentPos;
    Node currentNode=currentPos.currentNode();
    if (visitedNodes.add(currentNode)) {
      currentPos.setReturnedNodesCount(this.returnedNodesCount);
      if (!this.stopEvaluator.isStopNode(currentPos)) {
        try {
          this.addEndNodesToList(currentPos,this.traversableRels,this.traversableDirs);
          this.addEndNodesToList(currentPos,this.preservingRels,this.preservingDirs);
        }
 catch (        NotFoundException e) {
          continue;
        }
      }
      if (this.returnableEvaluator.isReturnableNode(currentPos)) {
        this.returnedNodesCount++;
        nodeToReturn=currentPos.currentNode();
      }
    }
  }
  return nodeToReturn;
}
Program: 155179
Project: 155179
Buggy source:
/** 
 * Invoking this method with no transaction running will cause the lock to  be released right away.
 * @param resource the resource on which the lock is taken
 * @param type type of lock (READ or WRITE)
 * @throws NotInTransactionException
 */
public void addLockToTransaction(Object resource,LockType type) throws NotInTransactionException {
  Transaction tx=getTransaction();
  List<LockElement> lockElements=lockMap.get(tx);
  if (lockElements != null) {
    lockElements.add(new LockElement(resource,type));
  }
 else {
    if (tx == null) {
      if (type == LockType.WRITE) {
        lockManager.releaseWriteLock(resource);
      }
 else       if (type == LockType.READ) {
        lockManager.releaseReadLock(resource);
      }
      return;
    }
    lockElements=new ArrayList<LockElement>();
    lockMap.put(tx,lockElements);
    lockElements.add(new LockElement(resource,type));
  }
}

Fixed version (ground truth):
/** 
 * Invoking this method with no transaction running will cause the lock to  be released right away.
 * @param resource the resource on which the lock is taken
 * @param type type of lock (READ or WRITE)
 * @throws NotInTransactionException
 */
public void addLockToTransaction(Object resource,LockType type) throws NotInTransactionException {
  Transaction tx=getTransaction();
  List<LockElement> lockElements=lockMap.get(tx);
  if (lockElements != null) {
    lockElements.add(new LockElement(resource,type));
  }
 else {
    if (tx == null) {
      if (type == LockType.WRITE) {
        lockManager.releaseWriteLock(resource);
      }
 else       if (type == LockType.READ) {
        lockManager.releaseReadLock(resource);
      }
      return;
    }
    lockElements=new ArrayList<LockElement>();
    lockMap.put(tx,lockElements);
    lockElements.add(new LockElement(resource,type));
    try {
      tx.registerSynchronization(new ReadOnlyTxReleaser(tx));
    }
 catch (    Exception e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 155180
Project: 155180
Buggy source:
private void displayRelationships(NodeOrRelationship thing,Output out,boolean verbose,Direction direction,String prefixString,String postfixString,String filter,boolean caseSensitiveFilters,boolean exactFilterMatch) throws ShellException, RemoteException {
  Pattern typeFilter=newPattern(filter,caseSensitiveFilters);
  for (  Relationship rel : thing.getRelationships(direction)) {
    String type=rel.getType().name();
    if (!matches(typeFilter,type,caseSensitiveFilters,exactFilterMatch)) {
      continue;
    }
    StringBuffer buf=new StringBuffer(getDisplayNameForCurrentNode());
    buf.append("String_Node_Str" + prefixString).append(rel.getType().name());
    if (verbose) {
      buf.append("String_Node_Str").append(rel.getId());
    }
    buf.append(postfixString + "String_Node_Str");
    buf.append(getDisplayNameForNode(rel.getEndNode()));
    out.println(buf);
  }
}

Fixed version (ground truth):
private void displayRelationships(NodeOrRelationship thing,Output out,boolean verbose,Direction direction,String prefixString,String postfixString,String filter,boolean caseSensitiveFilters,boolean exactFilterMatch) throws ShellException, RemoteException {
  Pattern typeFilter=newPattern(filter,caseSensitiveFilters);
  for (  Relationship rel : thing.getRelationships(direction)) {
    String type=rel.getType().name();
    if (!matches(typeFilter,type,caseSensitiveFilters,exactFilterMatch)) {
      continue;
    }
    StringBuffer buf=new StringBuffer(getDisplayNameForCurrentNode());
    buf.append("String_Node_Str" + prefixString).append(rel.getType().name());
    if (verbose) {
      buf.append("String_Node_Str").append(rel.getId());
    }
    buf.append(postfixString + "String_Node_Str");
    buf.append(getDisplayNameForNode(direction == Direction.OUTGOING ? rel.getEndNode() : rel.getStartNode()));
    out.println(buf);
  }
}
Program: 155181
Project: 155181
Buggy source:
public long createRelationship(long node1,long node2,RelationshipType type,Map<String,Object> properties){
  int firstNodeId=(int)(node1 & 0xFFFFFFFF);
  int secondNodeId=(int)(node2 & 0xFFFFFFFF);
  NodeRecord firstNode=getNodeRecord(node1);
  NodeRecord secondNode=getNodeRecord(secondNodeId);
  int typeId=typeHolder.getTypeId(type.name());
  if (typeId == -1) {
    typeId=createNewRelationshipType(type.name());
  }
  int id=getRelationshipStore().nextId();
  RelationshipRecord record=new RelationshipRecord(id,firstNodeId,secondNodeId,typeId);
  record.setInUse(true);
  record.setCreated();
  connectRelationship(firstNode,secondNode,record);
  getNodeStore().updateRecord(firstNode);
  getNodeStore().updateRecord(secondNode);
  record.setNextProp(createPropertyChain(properties));
  getRelationshipStore().updateRecord(record);
  return id & 0xFFFFFFFFL;
}

Fixed version (ground truth):
public long createRelationship(long node1,long node2,RelationshipType type,Map<String,Object> properties){
  int firstNodeId=(int)(node1 & 0xFFFFFFFF);
  int secondNodeId=(int)(node2 & 0xFFFFFFFF);
  NodeRecord firstNode=getNodeRecord(node1);
  NodeRecord secondNode=getNodeRecord(node2);
  int typeId=typeHolder.getTypeId(type.name());
  if (typeId == -1) {
    typeId=createNewRelationshipType(type.name());
  }
  int id=getRelationshipStore().nextId();
  RelationshipRecord record=new RelationshipRecord(id,firstNodeId,secondNodeId,typeId);
  record.setInUse(true);
  record.setCreated();
  connectRelationship(firstNode,secondNode,record);
  getNodeStore().updateRecord(firstNode);
  getNodeStore().updateRecord(secondNode);
  record.setNextProp(createPropertyChain(properties));
  getRelationshipStore().updateRecord(record);
  return id & 0xFFFFFFFFL;
}
Program: 155182
Project: 155182
Buggy source:
private int createPropertyChain(Map<String,Object> properties){
  if (properties == null) {
    return Record.NO_NEXT_PROPERTY.intValue();
  }
  PropertyStore propStore=getPropertyStore();
  List<PropertyRecord> propRecords=new ArrayList<PropertyRecord>();
  PropertyRecord prevRecord=null;
  for (  Entry<String,Object> entry : properties.entrySet()) {
    int keyId=indexHolder.getKeyId(entry.getKey());
    if (keyId == -1) {
      keyId=createNewPropertyIndex(entry.getKey());
    }
    int propertyId=propStore.nextId();
    PropertyRecord propertyRecord=new PropertyRecord(propertyId);
    propertyRecord.setInUse(true);
    propertyRecord.setCreated();
    propStore.encodeValue(propertyRecord,entry.getValue());
    if (prevRecord != null) {
      prevRecord.setPrevProp(propertyId);
      propertyRecord.setNextProp(prevRecord.getId());
    }
    propRecords.add(propertyRecord);
    prevRecord=propertyRecord;
  }
  for (int i=propRecords.size() - 1; i >= 0; i--) {
    propStore.updateRecord(propRecords.get(i));
  }
  if (prevRecord != null) {
    return prevRecord.getId();
  }
  return Record.NO_NEXT_PROPERTY.intValue();
}

Fixed version (ground truth):
private int createPropertyChain(Map<String,Object> properties){
  if (properties == null) {
    return Record.NO_NEXT_PROPERTY.intValue();
  }
  PropertyStore propStore=getPropertyStore();
  List<PropertyRecord> propRecords=new ArrayList<PropertyRecord>();
  PropertyRecord prevRecord=null;
  for (  Entry<String,Object> entry : properties.entrySet()) {
    int keyId=indexHolder.getKeyId(entry.getKey());
    if (keyId == -1) {
      keyId=createNewPropertyIndex(entry.getKey());
    }
    int propertyId=propStore.nextId();
    PropertyRecord propertyRecord=new PropertyRecord(propertyId);
    propertyRecord.setInUse(true);
    propertyRecord.setCreated();
    propertyRecord.setKeyIndexId(keyId);
    propStore.encodeValue(propertyRecord,entry.getValue());
    if (prevRecord != null) {
      prevRecord.setPrevProp(propertyId);
      propertyRecord.setNextProp(prevRecord.getId());
    }
    propRecords.add(propertyRecord);
    prevRecord=propertyRecord;
  }
  for (int i=propRecords.size() - 1; i >= 0; i--) {
    propStore.updateRecord(propRecords.get(i));
  }
  if (prevRecord != null) {
    return prevRecord.getId();
  }
  return Record.NO_NEXT_PROPERTY.intValue();
}
Program: 155183
Project: 155183
Buggy source:
private void connectRelationship(NodeRecord firstNode,NodeRecord secondNode,RelationshipRecord rel){
  rel.setFirstNextRel(firstNode.getNextRel());
  rel.setSecondNextRel(secondNode.getNextRel());
  if (firstNode.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord nextRel=getRelationshipRecord(firstNode.getNextRel() & 0xFFFFFFFFL);
    if (nextRel.getFirstNode() == firstNode.getId()) {
      nextRel.setFirstPrevRel(rel.getId());
    }
 else     if (nextRel.getSecondNode() == firstNode.getId()) {
      nextRel.setSecondPrevRel(rel.getId());
    }
 else {
      throw new RuntimeException(firstNode + "String_Node_Str" + nextRel);
    }
  }
  if (secondNode.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord nextRel=getRelationshipRecord(secondNode.getNextRel() & 0xFFFFFFFFL);
    if (nextRel.getFirstNode() == secondNode.getId()) {
      nextRel.setFirstPrevRel(rel.getId());
    }
 else     if (nextRel.getSecondNode() == secondNode.getId()) {
      nextRel.setSecondPrevRel(rel.getId());
    }
 else {
      throw new RuntimeException(firstNode + "String_Node_Str" + nextRel);
    }
  }
  firstNode.setNextRel(rel.getId());
  secondNode.setNextRel(rel.getId());
}

Fixed version (ground truth):
private void connectRelationship(NodeRecord firstNode,NodeRecord secondNode,RelationshipRecord rel){
  rel.setFirstNextRel(firstNode.getNextRel());
  rel.setSecondNextRel(secondNode.getNextRel());
  if (firstNode.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord nextRel=getRelationshipStore().getRecord(firstNode.getNextRel());
    if (nextRel.getFirstNode() == firstNode.getId()) {
      nextRel.setFirstPrevRel(rel.getId());
    }
 else     if (nextRel.getSecondNode() == firstNode.getId()) {
      nextRel.setSecondPrevRel(rel.getId());
    }
 else {
      throw new RuntimeException(firstNode + "String_Node_Str" + nextRel);
    }
    getRelationshipStore().updateRecord(nextRel);
  }
  if (secondNode.getNextRel() != Record.NO_NEXT_RELATIONSHIP.intValue()) {
    RelationshipRecord nextRel=getRelationshipStore().getRecord(secondNode.getNextRel());
    if (nextRel.getFirstNode() == secondNode.getId()) {
      nextRel.setFirstPrevRel(rel.getId());
    }
 else     if (nextRel.getSecondNode() == secondNode.getId()) {
      nextRel.setSecondPrevRel(rel.getId());
    }
 else {
      throw new RuntimeException(firstNode + "String_Node_Str" + nextRel);
    }
    getRelationshipStore().updateRecord(nextRel);
  }
  firstNode.setNextRel(rel.getId());
  secondNode.setNextRel(rel.getId());
}
Program: 155184
Project: 155184
Buggy source:
public synchronized void close() throws IOException {
  long endPosition=writeBuffer.getFileChannelPosition();
  if (xidIdentMap.size() > 0) {
    log.info("String_Node_Str" + xidIdentMap.size());
    log.info("String_Node_Str" + fileName + "String_Node_Str"+ currentLog);
    if (writeBuffer != null) {
      writeBuffer.force();
    }
    writeBuffer=null;
    fileChannel.close();
    return;
  }
  if (!keepLogs || backupSlave) {
    deleteCurrentLogFile(fileName + "String_Node_Str" + currentLog);
  }
 else {
    renameCurrentLogFileAndIncrementVersion(fileName + "String_Node_Str" + currentLog,endPosition);
  }
  setActiveLog(CLEAN);
}

Fixed version (ground truth):
public synchronized void close() throws IOException {
  if (fileChannel == null || !fileChannel.isOpen()) {
    log.info("String_Node_Str" + fileName + "String_Node_Str");
    return;
  }
  long endPosition=writeBuffer.getFileChannelPosition();
  if (xidIdentMap.size() > 0) {
    log.info("String_Node_Str" + xidIdentMap.size());
    log.info("String_Node_Str" + fileName + "String_Node_Str"+ currentLog);
    if (writeBuffer != null) {
      writeBuffer.force();
    }
    writeBuffer=null;
    fileChannel.close();
    return;
  }
  if (!keepLogs || backupSlave) {
    deleteCurrentLogFile(fileName + "String_Node_Str" + currentLog);
  }
 else {
    renameCurrentLogFileAndIncrementVersion(fileName + "String_Node_Str" + currentLog,endPosition);
  }
  setActiveLog(CLEAN);
}
Program: 155185
Project: 155185
Buggy source:
protected void commitPropertyMaps(ArrayMap<Integer,Property> cowPropertyAddMap,ArrayMap<Integer,Property> cowPropertyRemoveMap){
  if (cowPropertyAddMap != null) {
    if (propertyMap == null) {
      propertyMap=new ArrayMap<Integer,Property>();
    }
    for (    Integer index : cowPropertyAddMap.keySet()) {
      propertyMap.put(index,cowPropertyAddMap.get(index));
    }
  }
  if (cowPropertyRemoveMap != null && propertyMap != null) {
    for (    Integer index : cowPropertyRemoveMap.keySet()) {
      propertyMap.remove(index);
    }
  }
}

Fixed version (ground truth):
protected void commitPropertyMaps(ArrayMap<Integer,Property> cowPropertyAddMap,ArrayMap<Integer,Property> cowPropertyRemoveMap){
  if (propertyMap == null) {
    return;
  }
  if (cowPropertyAddMap != null) {
    for (    Integer index : cowPropertyAddMap.keySet()) {
      propertyMap.put(index,cowPropertyAddMap.get(index));
    }
  }
  if (cowPropertyRemoveMap != null && propertyMap != null) {
    for (    Integer index : cowPropertyRemoveMap.keySet()) {
      propertyMap.remove(index);
    }
  }
}
Program: 155186
Project: 155186
Buggy source:
private boolean ensureFullProperties(){
}

Fixed version (ground truth):
private boolean ensureFullProperties(){
  if (propertyMap == null) {
    RawPropertyData[] rawProperties=loadProperties();
    ArrayMap<Integer,Property> newPropertyMap=new ArrayMap<Integer,Property>(9,false,true);
    for (    RawPropertyData propData : rawProperties) {
      int propId=propData.getId();
      Property property=new Property(propId,propData.getValue());
      newPropertyMap.put(propData.getIndex(),property);
    }
    this.propertyMap=newPropertyMap;
    return true;
  }
  return false;
}
Program: 155187
Project: 155187
Buggy source:
protected void commitRelationshipMaps(ArrayMap<String,ArrayIntSet> cowRelationshipAddMap,ArrayMap<String,ArrayIntSet> cowRelationshipRemoveMap){
  if (cowRelationshipAddMap != null) {
    if (relationshipMap == null) {
      return;
    }
    for (    String type : cowRelationshipAddMap.keySet()) {
      ArrayIntSet source=cowRelationshipAddMap.get(type);
      if (source.size() == 0) {
        continue;
      }
      ArrayIntSet dest=new ArrayIntSet();
      ArrayIntSet orig=relationshipMap.get(type);
      if (orig != null) {
        for (        int relId : orig.values()) {
          dest.add(relId);
        }
      }
      for (      int relId : source.values()) {
        dest.add(relId);
      }
      relationshipMap.put(type,dest);
    }
  }
  if (cowRelationshipRemoveMap != null && relationshipMap != null) {
    for (    String type : cowRelationshipRemoveMap.keySet()) {
      ArrayIntSet source=cowRelationshipRemoveMap.get(type);
      if (source.size() == 0) {
        continue;
      }
      ArrayIntSet dest=new ArrayIntSet();
      ArrayIntSet orig=relationshipMap.get(type);
      if (orig != null) {
        for (        int relId : orig.values()) {
          if (!source.contains(relId)) {
            dest.add(relId);
          }
        }
        relationshipMap.put(type,dest);
      }
    }
  }
}

Fixed version (ground truth):
protected void commitRelationshipMaps(ArrayMap<String,ArrayIntSet> cowRelationshipAddMap,ArrayMap<String,ArrayIntSet> cowRelationshipRemoveMap){
  if (relationshipMap == null) {
    return;
  }
  if (cowRelationshipAddMap != null) {
    for (    String type : cowRelationshipAddMap.keySet()) {
      ArrayIntSet source=cowRelationshipAddMap.get(type);
      if (source.size() == 0) {
        continue;
      }
      ArrayIntSet dest=new ArrayIntSet();
      ArrayIntSet orig=relationshipMap.get(type);
      if (orig != null) {
        for (        int relId : orig.values()) {
          dest.add(relId);
        }
      }
      for (      int relId : source.values()) {
        dest.add(relId);
      }
      relationshipMap.put(type,dest);
    }
  }
  if (cowRelationshipRemoveMap != null && relationshipMap != null) {
    for (    String type : cowRelationshipRemoveMap.keySet()) {
      ArrayIntSet source=cowRelationshipRemoveMap.get(type);
      if (source.size() == 0) {
        continue;
      }
      ArrayIntSet dest=new ArrayIntSet();
      ArrayIntSet orig=relationshipMap.get(type);
      if (orig != null) {
        for (        int relId : orig.values()) {
          if (!source.contains(relId)) {
            dest.add(relId);
          }
        }
        relationshipMap.put(type,dest);
      }
    }
  }
}
Program: 155188
Project: 155188
Buggy source:
private void checkLogRotation() throws IOException {
  if (autoRotate && writeBuffer.getFileChannelPosition() >= rotateAtSize) {
    rotate();
  }
}

Fixed version (ground truth):
private void checkLogRotation() throws IOException {
  if (autoRotate && writeBuffer.getFileChannelPosition() >= rotateAtSize) {
    long currentPos=writeBuffer.getFileChannelPosition();
    long firstStartEntry=getFirstStartEntry(currentPos);
    if ((currentPos - firstStartEntry) < rotateAtSize / 2) {
      rotate();
    }
  }
}
Program: 155189
Project: 155189
Buggy source:
public boolean contains(int id){
  for (int i=0; i < arrayCount; i++) {
    if (rels[i] == id) {
      return true;
    }
  }
  if (arrayCount == -1) {
    return relationshipSet.remove(id);
  }
  return false;
}

Fixed version (ground truth):
public boolean contains(int id){
  for (int i=0; i < arrayCount; i++) {
    if (rels[i] == id) {
      return true;
    }
  }
  if (arrayCount == -1) {
    return relationshipSet.contains(id);
  }
  return false;
}
Program: 155190
Project: 155190
Buggy source:
public Iterable<PropertyIndex> index(String key){
  List<PropertyIndex> list=indexMap.get(key);
  TxCommitHook hook=txCommitHooks.get(getTransaction());
  if (hook != null) {
    PropertyIndex index=hook.getIndex(key);
    if (index != null) {
      if (list == null) {
        list=new ArrayList<PropertyIndex>();
      }
      list.add(index);
    }
  }
  if (list == null) {
    list=Collections.emptyList();
  }
  return list;
}

Fixed version (ground truth):
public Iterable<PropertyIndex> index(String key){
  List<PropertyIndex> list=indexMap.get(key);
  TxCommitHook hook=txCommitHooks.get(getTransaction());
  if (hook != null) {
    PropertyIndex index=hook.getIndex(key);
    if (index != null) {
      List<PropertyIndex> added=new ArrayList<PropertyIndex>();
      if (list != null) {
        added.addAll(list);
      }
      added.add(index);
      return added;
    }
  }
  if (list == null) {
    list=Collections.emptyList();
  }
  return list;
}
Program: 155191
Project: 155191
Buggy source:
private synchronized void addPropertyIndex(PropertyIndex index){
  List<PropertyIndex> list=indexMap.get(index.getKey());
  if (list == null) {
    list=new ArrayList<PropertyIndex>();
    indexMap.put(index.getKey(),list);
  }
  list.add(index);
  idToIndexMap.put(index.getKeyId(),index);
}

Fixed version (ground truth):
private synchronized void addPropertyIndex(PropertyIndex index){
  List<PropertyIndex> list=indexMap.get(index.getKey());
  if (list == null) {
    list=new CopyOnWriteArrayList<PropertyIndex>();
    indexMap.put(index.getKey(),list);
  }
  list.add(index);
  idToIndexMap.put(index.getKeyId(),index);
}
Program: 155194
Project: 155194
Buggy source:
void removeRelationship(RelationshipType type,int relId){
  if (getCowTxId() == null) {
    setupCowTx();
  }
  ArrayIntSet addedSet=nodeManager.getCowRelationshipAddMap(this,type.name());
  if (addedSet != null) {
    addedSet.remove(relId);
  }
  ArrayIntSet relationshipSet=nodeManager.getCowRelationshipRemoveMap(this,type.name(),true);
  relationshipSet.add(relId);
}

Fixed version (ground truth):
void removeRelationship(RelationshipType type,int relId){
  setupCowTx();
  ArrayIntSet addedSet=nodeManager.getCowRelationshipAddMap(this,type.name());
  if (addedSet != null) {
    addedSet.remove(relId);
  }
  ArrayIntSet relationshipSet=nodeManager.getCowRelationshipRemoveMap(this,type.name(),true);
  relationshipSet.add(relId);
}
Program: 155195
Project: 155195
Buggy source:
void addRelationship(RelationshipType type,int relId){
  if (getCowTxId() == null) {
    setupCowTx();
  }
  ArrayIntSet relationshipSet=nodeManager.getCowRelationshipAddMap(this,type.name(),true);
  relationshipSet.add(relId);
}

Fixed version (ground truth):
void addRelationship(RelationshipType type,int relId){
  setupCowTx();
  ArrayIntSet relationshipSet=nodeManager.getCowRelationshipAddMap(this,type.name(),true);
  relationshipSet.add(relId);
}