nus-yam/ex-repair huggingface dataset:
Program: 82538
Project: 82538
Buggy source:
private synchronized void updateLayout(){
  List<String> tableList=_clusterStatus.getTableList();
  HashMap<String,Map<String,String>> newLayout=new HashMap<String,Map<String,String>>();
  for (  String table : tableList) {
    DistributedLayoutManager layoutManager=new DistributedLayoutManager();
    String cluster=_clusterStatus.getCluster(true,table);
    List<String> shardServerList=_clusterStatus.getShardServerList(cluster);
    List<String> offlineShardServers=_clusterStatus.getOfflineShardServers(cluster);
    List<String> shardList=getShardList(cluster,table);
    layoutManager.setNodes(shardServerList);
    layoutManager.setNodesOffline(offlineShardServers);
    layoutManager.setShards(shardList);
    layoutManager.init();
    Map<String,String> layout=layoutManager.getLayout();
    newLayout.put(table,layout);
  }
  _shardServerLayout.set(newLayout);
}

Fixed version (ground truth):
private synchronized void updateLayout(){
  List<String> tableList=_clusterStatus.getTableList();
  HashMap<String,Map<String,String>> newLayout=new HashMap<String,Map<String,String>>();
  for (  String table : tableList) {
    DistributedLayoutManager layoutManager=new DistributedLayoutManager();
    String cluster=_clusterStatus.getCluster(false,table);
    List<String> shardServerList=_clusterStatus.getShardServerList(cluster);
    List<String> offlineShardServers=_clusterStatus.getOfflineShardServers(cluster);
    List<String> shardList=getShardList(cluster,table);
    layoutManager.setNodes(shardServerList);
    layoutManager.setNodesOffline(offlineShardServers);
    layoutManager.setShards(shardList);
    layoutManager.init();
    Map<String,String> layout=layoutManager.getLayout();
    newLayout.put(table,layout);
  }
  _shardServerLayout.set(newLayout);
}
Program: 82539
Project: 82539
Buggy source:
private boolean inSafeMode(boolean useCache,String table){
  String cluster=_clusterStatus.getCluster(true,table);
  return _clusterStatus.isInSafeMode(cluster);
}

Fixed version (ground truth):
private boolean inSafeMode(boolean useCache,String table){
  String cluster=_clusterStatus.getCluster(useCache,table);
  return _clusterStatus.isInSafeMode(cluster);
}
Program: 82540
Project: 82540
Buggy source:
@Override public final void removeTable(String table,boolean deleteIndexFiles) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(true,table);
    RemoveTable.removeTable(_zookeeper,cluster,table,deleteIndexFiles);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public final void removeTable(String table,boolean deleteIndexFiles) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(false,table);
    RemoveTable.removeTable(_zookeeper,cluster,table,deleteIndexFiles);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}
Program: 82541
Project: 82541
Buggy source:
@Override public final void enableTable(String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(true,table);
    EnableTable.enableTable(_zookeeper,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public final void enableTable(String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(false,table);
    EnableTable.enableTable(_zookeeper,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}
Program: 82542
Project: 82542
Buggy source:
@Override public final TableDescriptor describe(final String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(true,table);
    return _clusterStatus.getTableDescriptor(true,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + table + "String_Node_Str",e);
    throw new BException("String_Node_Str" + table + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public final TableDescriptor describe(final String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(false,table);
    return _clusterStatus.getTableDescriptor(true,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + table + "String_Node_Str",e);
    throw new BException("String_Node_Str" + table + "String_Node_Str",e);
  }
}
Program: 82543
Project: 82543
Buggy source:
@Override public final void disableTable(String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(true,table);
    DisableTable.disableTable(_zookeeper,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public final void disableTable(String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(false,table);
    DisableTable.disableTable(_zookeeper,cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}
Program: 82544
Project: 82544
Buggy source:
public void init(){
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(new TimerTask(){
    @Override public void run(){
      tryToInterrupt();
    }
  }
,_delay,_delay);
}

Fixed version (ground truth):
public void init(){
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(new TimerTask(){
    @Override public void run(){
      try {
        tryToInterrupt();
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
,_delay,_delay);
}
Program: 82545
Project: 82545
Buggy source:
@Override public void run(){
  tryToInterrupt();
}

Fixed version (ground truth):
@Override public void run(){
  try {
    tryToInterrupt();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 82546
Project: 82546
Buggy source:
public void init(){
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(new TimerTask(){
    @Override public void run(){
      processRunningThreads();
    }
  }
,TimeUnit.SECONDS.toMillis(5),TimeUnit.SECONDS.toMillis(5));
}

Fixed version (ground truth):
public void init(){
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(new TimerTask(){
    @Override public void run(){
      try {
        processRunningThreads();
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
,TimeUnit.SECONDS.toMillis(5),TimeUnit.SECONDS.toMillis(5));
}
Program: 82547
Project: 82547
Buggy source:
@Override protected boolean removeEldestEntry(java.util.Map.Entry<K,V> eldest){
  boolean b=size() > _cachedElements;
  if (b) {
    LOG.debug("String_Node_Str",_name,eldest);
  }
  return b;
}

Fixed version (ground truth):
@Override protected boolean removeEldestEntry(java.util.Map.Entry<K,V> eldest){
  boolean b=size() > _cachedElements;
  if (b) {
    LOG.debug("String_Node_Str",_name,eldest);
    return true;
  }
  return false;
}
Program: 82548
Project: 82548
Buggy source:
public static Row getRow(Iterable<Document> docs){
  Row row=new Row();
  boolean empty=true;
  if (docs == null) {
    return null;
  }
  for (  Document document : docs) {
    empty=false;
    Record record=new Record();
    String rowId=populateRecord(record,document);
    if (record.getColumns() != null) {
      row.addToRecords(record);
    }
    if (row.id == null) {
      row.setId(rowId);
    }
    row.recordCount++;
  }
  if (empty) {
    return null;
  }
  return row;
}

Fixed version (ground truth):
public static Row getRow(Iterable<Document> docs){
  Row row=new Row();
  boolean empty=true;
  if (docs == null) {
    return null;
  }
  for (  Document document : docs) {
    empty=false;
    Record record=new Record();
    String rowId=populateRecord(record,document);
    if (record.getColumns() != null) {
      row.addToRecords(record);
    }
    if (row.id == null) {
      row.setId(rowId);
    }
    row.recordCount++;
  }
  if (empty) {
    return null;
  }
  if (row.records == null) {
    row.records=new ArrayList<Record>();
  }
  return row;
}
Program: 82549
Project: 82549
Buggy source:
private boolean findEmptyLocation(BlockCacheLocation location){
  OUTER:   for (int bankId=0; bankId < _banks.length; bankId++) {
    AtomicInteger bitSetCounter=_lockCounters[bankId];
    BlockLocks bitSet=_locks[bankId];
    if (bitSetCounter.get() == _numberOfBlocksPerBank) {
      continue OUTER;
    }
    int bit=bitSet.nextClearBit(0);
    INNER:     while (bit != -1) {
      if (bit >= _numberOfBlocksPerBank) {
        continue OUTER;
      }
      if (!bitSet.set(bit)) {
        bit=bitSet.nextClearBit(0);
        continue INNER;
      }
 else {
        location.setBankId(bankId);
        location.setBlock(bit);
        bitSetCounter.incrementAndGet();
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean findEmptyLocation(BlockCacheLocation location){
  for (int j=0; j < 10; j++) {
    OUTER:     for (int bankId=0; bankId < _banks.length; bankId++) {
      AtomicInteger bitSetCounter=_lockCounters[bankId];
      BlockLocks bitSet=_locks[bankId];
      if (bitSetCounter.get() == _numberOfBlocksPerBank) {
        continue OUTER;
      }
      int bit=bitSet.nextClearBit(0);
      INNER:       while (bit != -1) {
        if (bit >= _numberOfBlocksPerBank) {
          continue OUTER;
        }
        if (!bitSet.set(bit)) {
          bit=bitSet.nextClearBit(0);
          continue INNER;
        }
 else {
          location.setBankId(bankId);
          location.setBlock(bit);
          bitSetCounter.incrementAndGet();
          return true;
        }
      }
    }
  }
  return false;
}
Program: 82550
Project: 82550
Buggy source:
private void setupFlushCacheTimer(){
  _timerCacheFlush=new Timer("String_Node_Str",true);
  _timerCacheFlush.schedule(new TimerTask(){
    @Override public void run(){
      clearMapOfOldTables(_tableAnalyzers);
      clearMapOfOldTables(_tableDescriptors);
      clearMapOfOldTables(_layoutManagers);
      clearMapOfOldTables(_layoutCache);
      Map<String,Map<String,BlurIndex>> oldIndexesThatNeedToBeClosed=clearMapOfOldTables(_indexes);
      for (      String table : oldIndexesThatNeedToBeClosed.keySet()) {
        Map<String,BlurIndex> indexes=oldIndexesThatNeedToBeClosed.get(table);
        if (indexes == null) {
          continue;
        }
        for (        String shard : indexes.keySet()) {
          BlurIndex index=indexes.get(shard);
          if (index == null) {
            continue;
          }
          LOG.info("String_Node_Str",index,table,shard);
          try {
            _filterCache.closing(table,shard,index);
            index.close();
          }
 catch (          IOException e) {
            LOG.error("String_Node_Str",e,index,table,shard);
          }
        }
      }
    }
  }
,_delay,_delay);
}

Fixed version (ground truth):
private void setupFlushCacheTimer(){
  _timerCacheFlush=new Timer("String_Node_Str",true);
  _timerCacheFlush.schedule(new TimerTask(){
    @Override public void run(){
      clearMapOfOldTables(_tableAnalyzers);
      clearMapOfOldTables(_tableDescriptors);
      clearMapOfOldTables(_layoutManagers);
      clearMapOfOldTables(_layoutCache);
      Map<String,Map<String,BlurIndex>> oldIndexesThatNeedToBeClosed=clearMapOfOldTables(_indexes);
      for (      String table : oldIndexesThatNeedToBeClosed.keySet()) {
        Map<String,BlurIndex> indexes=oldIndexesThatNeedToBeClosed.get(table);
        if (indexes == null) {
          continue;
        }
        for (        String shard : indexes.keySet()) {
          BlurIndex index=indexes.get(shard);
          if (index == null) {
            continue;
          }
          close(index,table,shard);
        }
      }
      for (      String table : _indexes.keySet()) {
        Map<String,BlurIndex> shardMap=_indexes.get(table);
        if (shardMap != null) {
          Set<String> shards=new HashSet<String>(shardMap.keySet());
          Set<String> shardsToServe=getShardsToServe(table);
          shards.removeAll(shardsToServe);
          if (!shards.isEmpty()) {
            LOG.info("String_Node_Str",table,shards);
          }
          for (          String shard : shards) {
            LOG.info("String_Node_Str",table,shard);
            BlurIndex index=shardMap.remove(shard);
            close(index,table,shard);
          }
        }
      }
    }
  }
,_delay,_delay);
}
Program: 82551
Project: 82551
Buggy source:
@Override public void run(){
  clearMapOfOldTables(_tableAnalyzers);
  clearMapOfOldTables(_tableDescriptors);
  clearMapOfOldTables(_layoutManagers);
  clearMapOfOldTables(_layoutCache);
  Map<String,Map<String,BlurIndex>> oldIndexesThatNeedToBeClosed=clearMapOfOldTables(_indexes);
  for (  String table : oldIndexesThatNeedToBeClosed.keySet()) {
    Map<String,BlurIndex> indexes=oldIndexesThatNeedToBeClosed.get(table);
    if (indexes == null) {
      continue;
    }
    for (    String shard : indexes.keySet()) {
      BlurIndex index=indexes.get(shard);
      if (index == null) {
        continue;
      }
      LOG.info("String_Node_Str",index,table,shard);
      try {
        _filterCache.closing(table,shard,index);
        index.close();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e,index,table,shard);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  clearMapOfOldTables(_tableAnalyzers);
  clearMapOfOldTables(_tableDescriptors);
  clearMapOfOldTables(_layoutManagers);
  clearMapOfOldTables(_layoutCache);
  Map<String,Map<String,BlurIndex>> oldIndexesThatNeedToBeClosed=clearMapOfOldTables(_indexes);
  for (  String table : oldIndexesThatNeedToBeClosed.keySet()) {
    Map<String,BlurIndex> indexes=oldIndexesThatNeedToBeClosed.get(table);
    if (indexes == null) {
      continue;
    }
    for (    String shard : indexes.keySet()) {
      BlurIndex index=indexes.get(shard);
      if (index == null) {
        continue;
      }
      close(index,table,shard);
    }
  }
  for (  String table : _indexes.keySet()) {
    Map<String,BlurIndex> shardMap=_indexes.get(table);
    if (shardMap != null) {
      Set<String> shards=new HashSet<String>(shardMap.keySet());
      Set<String> shardsToServe=getShardsToServe(table);
      shards.removeAll(shardsToServe);
      if (!shards.isEmpty()) {
        LOG.info("String_Node_Str",table,shards);
      }
      for (      String shard : shards) {
        LOG.info("String_Node_Str",table,shard);
        BlurIndex index=shardMap.remove(shard);
        close(index,table,shard);
      }
    }
  }
}
Program: 82552
Project: 82552
Buggy source:
private void setupSafeMode() throws KeeperException, InterruptedException {
  String shardsPath=ZookeeperPathConstants.getBlurOnlineShardsPath();
  List<String> children=_zookeeper.getChildren(shardsPath,false);
  if (children.size() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  if (children.size() != 1) {
    return;
  }
  LOG.info("String_Node_Str");
  long timestamp=System.currentTimeMillis() + SAFE_MODE_DELAY;
  String blurSafemodePath=ZookeeperPathConstants.getBlurSafemodePath();
  Stat stat=_zookeeper.exists(blurSafemodePath,false);
  if (stat == null) {
    _zookeeper.create(blurSafemodePath,Long.toString(timestamp).getBytes(),Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
  }
 else {
    _zookeeper.setData(blurSafemodePath,Long.toString(timestamp).getBytes(),-1);
  }
}

Fixed version (ground truth):
private void setupSafeMode() throws KeeperException, InterruptedException {
  String shardsPath=ZookeeperPathConstants.getBlurOnlineShardsPath();
  List<String> children=_zookeeper.getChildren(shardsPath,false);
  if (children.size() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  if (children.size() != 1) {
    return;
  }
  LOG.info("String_Node_Str");
  long timestamp=System.currentTimeMillis() + SAFE_MODE_DELAY;
  String blurSafemodePath=ZookeeperPathConstants.getBlurSafemodePath();
  Stat stat=_zookeeper.exists(blurSafemodePath,false);
  if (stat == null) {
    _zookeeper.create(blurSafemodePath,Long.toString(timestamp).getBytes(),Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
  }
 else {
    _zookeeper.setData(blurSafemodePath,Long.toString(timestamp).getBytes(),-1);
  }
  removeAnyTableLocks();
}
Program: 82553
Project: 82553
Buggy source:
private void setupTableWarmer(){
  _timerTableWarmer=new Timer("String_Node_Str",true);
  _timerTableWarmer.schedule(new TimerTask(){
    @Override public void run(){
      List<String> tableList=_clusterStatus.getTableList();
      for (      String table : tableList) {
        try {
          int count=getIndexes(table).size();
          LOG.info("String_Node_Str",table,count);
        }
 catch (        IOException e) {
          LOG.error("String_Node_Str",e,table);
        }
      }
    }
  }
,_delay,_delay);
}

Fixed version (ground truth):
private void setupTableWarmer(){
  _timerTableWarmer=new Timer("String_Node_Str",true);
  _timerTableWarmer.schedule(new TimerTask(){
    @Override public void run(){
      List<String> tableList=_clusterStatus.getTableList();
      for (      String table : tableList) {
        try {
          int count=getIndexes(table).size();
          LOG.debug("String_Node_Str",table,count);
        }
 catch (        IOException e) {
          LOG.error("String_Node_Str",e,table);
        }
      }
    }
  }
,_delay,_delay);
}
Program: 82554
Project: 82554
Buggy source:
private ClusterStatus getClusterStatus(){
  return new ClusterStatus(){
    @Override public List<String> getClusterList(){
      return Arrays.asList("String_Node_Str");
    }
    @Override public List<String> getControllerServerList(){
      throw new RuntimeException("String_Node_Str");
    }
    @Override public List<String> getOnlineShardServers(    String cluster){
      return getShardServerList(cluster);
    }
    @Override public List<String> getShardServerList(    String cluster){
      List<String> nodes=new ArrayList<String>(shardServers.keySet());
      Collections.sort(nodes);
      return nodes;
    }
    @Override public TableDescriptor getTableDescriptor(    String table){
      TableDescriptor tableDescriptor=new TableDescriptor();
      tableDescriptor.cluster="String_Node_Str";
      tableDescriptor.shardCount=3;
      return tableDescriptor;
    }
    @Override public List<String> getTableList(){
      return Arrays.asList(TABLE);
    }
    @Override public String getCluster(    String table){
      return "String_Node_Str";
    }
    @Override public boolean exists(    String table){
      return false;
    }
    @Override public boolean isEnabled(    String table){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private ClusterStatus getClusterStatus(){
  return new ClusterStatus(){
    @Override public List<String> getClusterList(){
      return Arrays.asList("String_Node_Str");
    }
    @Override public List<String> getControllerServerList(){
      throw new RuntimeException("String_Node_Str");
    }
    @Override public List<String> getOnlineShardServers(    String cluster){
      return getShardServerList(cluster);
    }
    @Override public List<String> getShardServerList(    String cluster){
      List<String> nodes=new ArrayList<String>(shardServers.keySet());
      Collections.sort(nodes);
      return nodes;
    }
    @Override public TableDescriptor getTableDescriptor(    String table){
      TableDescriptor tableDescriptor=new TableDescriptor();
      tableDescriptor.cluster="String_Node_Str";
      tableDescriptor.shardCount=3;
      return tableDescriptor;
    }
    @Override public List<String> getTableList(){
      return Arrays.asList(TABLE);
    }
    @Override public String getCluster(    String table){
      return "String_Node_Str";
    }
    @Override public boolean exists(    String table){
      return false;
    }
    @Override public boolean isEnabled(    String table){
      return false;
    }
    @Override public void clearLocks(    String table){
    }
  }
;
}
Program: 82555
Project: 82555
Buggy source:
@Override public boolean obtain() throws IOException {
  try {
    LOG.info("String_Node_Str",_instanceIndexLockPath);
    Stat stat=_zk.exists(_instanceIndexLockPath,false);
    if (stat != null) {
      byte[] data=_zk.getData(_instanceIndexLockPath,false,stat);
      if (_nodeName.equals(new String(data))) {
        LOG.warn("String_Node_Str",_instanceIndexLockPath);
        _zk.delete(_instanceIndexLockPath,-1);
      }
 else {
        LOG.info("String_Node_Str",_instanceIndexLockPath,new String(data));
        return false;
      }
    }
    _zk.create(_instanceIndexLockPath,_nodeName.getBytes(),Ids.OPEN_ACL_UNSAFE,CreateMode.EPHEMERAL);
    _stat=stat;
    return true;
  }
 catch (  KeeperException e) {
    if (e.code() == Code.NODEEXISTS) {
      return false;
    }
    throw new IOException(e);
  }
catch (  InterruptedException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
@Override public boolean obtain() throws IOException {
  try {
    LOG.info("String_Node_Str",_instanceIndexLockPath);
    Stat stat=_zk.exists(_instanceIndexLockPath,false);
    if (stat != null) {
      byte[] data=_zk.getData(_instanceIndexLockPath,false,stat);
      if (_nodeName.equals(new String(data))) {
        LOG.warn("String_Node_Str",_instanceIndexLockPath);
        _zk.delete(_instanceIndexLockPath,-1);
      }
 else {
        LOG.info("String_Node_Str",_instanceIndexLockPath,new String(data));
        return false;
      }
    }
    _zk.create(_instanceIndexLockPath,_nodeName.getBytes(),Ids.OPEN_ACL_UNSAFE,CreateMode.EPHEMERAL);
    return true;
  }
 catch (  KeeperException e) {
    if (e.code() == Code.NODEEXISTS) {
      return false;
    }
    throw new IOException(e);
  }
catch (  InterruptedException e) {
    throw new IOException(e);
  }
}
Program: 82556
Project: 82556
Buggy source:
@Override public void release() throws IOException {
  try {
    _zk.delete(_instanceIndexLockPath,_stat.getVersion());
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
catch (  KeeperException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
@Override public void release() throws IOException {
  try {
    _zk.delete(_instanceIndexLockPath,-1);
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
catch (  KeeperException e) {
    throw new IOException(e);
  }
}
Program: 82557
Project: 82557
Buggy source:
@Override public void onError(Exception exception){
  _pool._numberOfConnections.decrementAndGet();
  _realCallback.onError(exception);
}

Fixed version (ground truth):
@Override public void onError(Exception exception){
  AtomicInteger counter=_pool._numberOfConnections.get(_connection._host);
  if (counter != null) {
    counter.decrementAndGet();
  }
  _realCallback.onError(exception);
}
Program: 82559
Project: 82559
Buggy source:
private void returnClient(Connection connection,TAsyncClient client) throws InterruptedException {
  if (!client.hasError()) {
    getQueue(connection).put(client);
  }
 else {
    _numberOfConnections.decrementAndGet();
  }
}

Fixed version (ground truth):
private void returnClient(Connection connection,TAsyncClient client) throws InterruptedException {
  if (!client.hasError()) {
    getQueue(connection).put(client);
  }
 else {
    AtomicInteger counter=_numberOfConnections.get(connection._host);
    if (counter != null) {
      counter.decrementAndGet();
    }
  }
}
Program: 82560
Project: 82560
Buggy source:
@Override protected BlurIndex openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  URI tableUri=getTableURI(table);
  Path tablePath=new Path(tableUri.toString());
  Path hdfsDirPath=new Path(tablePath,shard);
  String shardPath=ZookeeperPathConstants.getBlurLockPath(table) + "String_Node_Str" + shard;
  ZookeeperLockFactory lockFactory=new ZookeeperLockFactory(_zookeeper,shardPath);
  HdfsDirectory directory=new HdfsDirectory(hdfsDirPath);
  directory.setLockFactory(lockFactory);
  BlockDirectory baseDirectory=new BlockDirectory(table + "String_Node_Str" + shard,directory,_cache);
  BlurIndexWriter writer=new BlurIndexWriter();
  writer.setCloser(_closer);
  writer.setCommiter(_commiter);
  writer.setAnalyzer(getAnalyzer(table));
  writer.setDirectory(baseDirectory);
  writer.setRefresher(_refresher);
  writer.init();
  return warmUp(writer);
}

Fixed version (ground truth):
@Override protected BlurIndex openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  URI tableUri=getTableURI(table);
  Path tablePath=new Path(tableUri.toString());
  Path hdfsDirPath=new Path(tablePath,shard);
  String shardPath=ZookeeperPathConstants.getBlurLockPath(table) + "String_Node_Str" + shard;
  ZookeeperLockFactory lockFactory=new ZookeeperLockFactory(_zookeeper,shardPath);
  DirectIODirectory directory=new HdfsDirectory(hdfsDirPath);
  directory.setLockFactory(lockFactory);
  TableDescriptor descriptor=_clusterStatus.getTableDescriptor(table);
  String compressionClass=descriptor.compressionClass;
  int compressionBlockSize=descriptor.compressionBlockSize;
  if (compressionClass != null) {
    CompressionCodec compressionCodec;
    try {
      compressionCodec=CreateTable.getInstance(compressionClass);
      directory=new CompressedFieldDataDirectory(directory,compressionCodec,compressionBlockSize);
    }
 catch (    Exception e) {
      throw new IOException(e);
    }
  }
  BlockDirectory baseDirectory=new BlockDirectory(table + "String_Node_Str" + shard,directory,_cache);
  BlurIndexWriter writer=new BlurIndexWriter();
  writer.setCloser(_closer);
  writer.setCommiter(_commiter);
  writer.setAnalyzer(getAnalyzer(table));
  writer.setDirectory(baseDirectory);
  writer.setRefresher(_refresher);
  writer.init();
  return warmUp(writer);
}
Program: 82561
Project: 82561
Buggy source:
private void fetchBlock(int blockId) throws IOException {
  long position=_blockPositions[blockId];
  int length=_blockLengths[blockId];
  _indexInput.seek(position);
  _indexInput.readBytes(_decompressionBuffer,0,length);
  _decompressor.reset();
  _decompressor.setInput(_decompressionBuffer,0,length);
  _blockBufferLength=_decompressor.decompress(_blockBuffer,0,_blockBuffer.length);
  _currentBlockId=blockId;
}

Fixed version (ground truth):
private void fetchBlock(int blockId) throws IOException {
  long position=_blockPositions[blockId];
  int length=_blockLengths[blockId];
  _indexInput.seek(position);
  _indexInput.readBytes(_decompressionBuffer,0,length);
synchronized (_decompressor) {
    _decompressor.reset();
    _decompressor.setInput(_decompressionBuffer,0,length);
    _blockBufferLength=_decompressor.decompress(_blockBuffer,0,_blockBuffer.length);
  }
  _currentBlockId=blockId;
}
Program: 82562
Project: 82562
Buggy source:
public void close() throws IOException {
  _decompressor.end();
  if (!_isClone) {
    _indexInput.close();
  }
}

Fixed version (ground truth):
public void close() throws IOException {
  if (!_isClone) {
    _decompressor.end();
    _indexInput.close();
  }
}
Program: 82563
Project: 82563
Buggy source:
public CompressedIndexInput(String name,Directory directory,CompressionCodec codec) throws IOException {
  _codec=codec;
  _decompressor=_codec.createDecompressor();
  _indexInput=directory.openInput(name);
  _realLength=_indexInput.length();
  _indexInput.seek(_realLength - _SIZES_META_DATA);
  long metaDataLength=_indexInput.readLong();
  int blockCount=_indexInput.readInt();
  _blockSize=_indexInput.readInt();
  _origLength=_indexInput.readLong();
  _blockLengths=new int[blockCount];
  _blockPositions=new long[blockCount];
  _indexInput.seek(_realLength - _SIZES_META_DATA - metaDataLength);
  for (int i=0; i < blockCount; i++) {
    _blockPositions[i]=_indexInput.readVLong();
    _blockLengths[i]=_indexInput.readVInt();
  }
  _blockBuffer=new byte[_blockSize];
  int dsize=_blockSize * 2;
  if (dsize < _MIN_BUFFER_SIZE) {
    dsize=_MIN_BUFFER_SIZE;
  }
  _decompressionBuffer=new byte[dsize];
}

Fixed version (ground truth):
public CompressedIndexInput(String name,Directory directory,CompressionCodec codec) throws IOException {
  _decompressor=codec.createDecompressor();
  _indexInput=directory.openInput(name);
  _realLength=_indexInput.length();
  _indexInput.seek(_realLength - _SIZES_META_DATA);
  long metaDataLength=_indexInput.readLong();
  int blockCount=_indexInput.readInt();
  _blockSize=_indexInput.readInt();
  _origLength=_indexInput.readLong();
  _blockLengths=new int[blockCount];
  _blockPositions=new long[blockCount];
  _indexInput.seek(_realLength - _SIZES_META_DATA - metaDataLength);
  for (int i=0; i < blockCount; i++) {
    _blockPositions[i]=_indexInput.readVLong();
    _blockLengths[i]=_indexInput.readVInt();
  }
  setupBuffers(this);
}
Program: 82564
Project: 82564
Buggy source:
public CompressedFieldDataDirectory(Directory dir,CompressionCodec compression,int blockSize){
  _directory=dir;
  if (compression == null) {
    _compression=DEFAULT_COMPRESSION;
  }
 else {
    _compression=compression;
  }
  _writingBlockSize=blockSize;
}

Fixed version (ground truth):
public CompressedFieldDataDirectory(DirectIODirectory dir,CompressionCodec compression,int blockSize){
  _directory=dir;
  if (compression == null) {
    _compression=DEFAULT_COMPRESSION;
  }
 else {
    _compression=compression;
  }
  _writingBlockSize=blockSize;
}
Program: 82565
Project: 82565
Buggy source:
public Object clone(){
  CompressedIndexInput clone=(CompressedIndexInput)super.clone();
  clone._isClone=true;
  clone._decompressor=_codec.createDecompressor();
  clone._indexInput=(IndexInput)_indexInput.clone();
  return clone;
}

Fixed version (ground truth):
public Object clone(){
  CompressedIndexInput clone=(CompressedIndexInput)super.clone();
  clone._isClone=true;
  clone._indexInput=(IndexInput)_indexInput.clone();
  setupBuffers(clone);
  return clone;
}
Program: 82566
Project: 82566
Buggy source:
@Test public void testCompressedFieldDataDirectoryBasic() throws CorruptIndexException, IOException {
  RAMDirectory dir=new RAMDirectory();
  CompressedFieldDataDirectory directory=new CompressedFieldDataDirectory(dir,COMPRESSION_CODEC);
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(directory,config);
  addDocs(writer,0,10);
  writer.close();
  testFetches(directory);
}

Fixed version (ground truth):
@Test public void testCompressedFieldDataDirectoryBasic() throws CorruptIndexException, IOException {
  RAMDirectory dir=new RAMDirectory();
  CompressedFieldDataDirectory directory=new CompressedFieldDataDirectory(DirectIODirectory.wrap(dir),COMPRESSION_CODEC);
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(directory,config);
  addDocs(writer,0,10);
  writer.close();
  testFetches(directory);
}
Program: 82567
Project: 82567
Buggy source:
@Test public void testCompressedFieldDataDirectoryTransition() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory dir=new RAMDirectory();
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(dir,config);
  addDocs(writer,0,5);
  writer.close();
  CompressedFieldDataDirectory directory=new CompressedFieldDataDirectory(dir,COMPRESSION_CODEC);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory,config);
  addDocs(writer,5,5);
  writer.close();
  testFetches(directory);
}

Fixed version (ground truth):
@Test public void testCompressedFieldDataDirectoryTransition() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory dir=new RAMDirectory();
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(dir,config);
  addDocs(writer,0,5);
  writer.close();
  CompressedFieldDataDirectory directory=new CompressedFieldDataDirectory(DirectIODirectory.wrap(dir),COMPRESSION_CODEC);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory,config);
  addDocs(writer,5,5);
  writer.close();
  testFetches(directory);
}
Program: 82568
Project: 82568
Buggy source:
@Test public void testCompressedFieldDataDirectoryMixedBlockSize() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory dir=new RAMDirectory();
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(dir,config);
  addDocs(writer,0,5);
  writer.close();
  CompressedFieldDataDirectory directory1=new CompressedFieldDataDirectory(dir,COMPRESSION_CODEC,2);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory1,config);
  addDocs(writer,5,2);
  writer.close();
  CompressedFieldDataDirectory directory2=new CompressedFieldDataDirectory(dir,COMPRESSION_CODEC,4);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory2,config);
  addDocs(writer,7,3);
  writer.close();
  testFetches(directory2);
}

Fixed version (ground truth):
@Test public void testCompressedFieldDataDirectoryMixedBlockSize() throws CorruptIndexException, LockObtainFailedException, IOException {
  RAMDirectory dir=new RAMDirectory();
  IndexWriterConfig config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  TieredMergePolicy mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  IndexWriter writer=new IndexWriter(dir,config);
  addDocs(writer,0,5);
  writer.close();
  CompressedFieldDataDirectory directory1=new CompressedFieldDataDirectory(DirectIODirectory.wrap(dir),COMPRESSION_CODEC,2);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory1,config);
  addDocs(writer,5,2);
  writer.close();
  CompressedFieldDataDirectory directory2=new CompressedFieldDataDirectory(DirectIODirectory.wrap(dir),COMPRESSION_CODEC,4);
  config=new IndexWriterConfig(Version.LUCENE_33,new KeywordAnalyzer());
  mergePolicy=(TieredMergePolicy)config.getMergePolicy();
  mergePolicy.setUseCompoundFile(false);
  writer=new IndexWriter(directory2,config);
  addDocs(writer,7,3);
  writer.close();
  testFetches(directory2);
}
Program: 82570
Project: 82570
Buggy source:
private Map<String,String> loadHdfsInstances(Properties props){
  Map<String,String> instances=new HashMap<String,String>();
  if (props.containsKey("String_Node_Str")) {
    String[] hdfsNames=props.getProperty("String_Node_Str").split("String_Node_Str");
    for (    String hdfs : hdfsNames) {
      instances.put(hdfs,props.getProperty("String_Node_Str" + hdfs + "String_Node_Str"));
    }
  }
  return instances;
}

Fixed version (ground truth):
private Map<String,Map<String,String>> loadHdfsInstances(Properties props){
  Map<String,Map<String,String>> instances=new HashMap<String,Map<String,String>>();
  if (props.containsKey("String_Node_Str")) {
    String[] hdfsNames=props.getProperty("String_Node_Str").split("String_Node_Str");
    for (    String hdfs : hdfsNames) {
      Map<String,String> instanceInfo=new HashMap<String,String>();
      instanceInfo.put("String_Node_Str",props.getProperty("String_Node_Str" + hdfs + "String_Node_Str"));
      instanceInfo.put("String_Node_Str",props.getProperty("String_Node_Str" + hdfs + "String_Node_Str"));
      instances.put(hdfs,instanceInfo);
    }
  }
  return instances;
}
Program: 82572
Project: 82572
Buggy source:
private void runInitialRegistration(){
  ControllerCollector.collect(this,jdbc);
  ClusterCollector.collect(this,jdbc);
}

Fixed version (ground truth):
private void runInitialRegistration(){
  ControllerCollector.collect(this,jdbc,props,this);
  ClusterCollector.collect(this,jdbc);
}
Program: 82573
Project: 82573
Buggy source:
public ZookeeperInstance(String name,String url,JdbcTemplate jdbc){
  this.name=name;
  this.url=url;
  this.jdbc=jdbc;
  initializeZkInstanceModel();
  resetConnection();
}

Fixed version (ground truth):
public ZookeeperInstance(String name,String url,JdbcTemplate jdbc,Properties props){
  this.name=name;
  this.url=url;
  this.jdbc=jdbc;
  this.props=props;
  initializeZkInstanceModel();
  resetConnection();
}
Program: 82574
Project: 82574
Buggy source:
private List<String> getControllers(){
  try {
    return zk.getChildren("String_Node_Str",false);
  }
 catch (  KeeperException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return new ArrayList<String>();
}

Fixed version (ground truth):
private List<String> getControllers(){
  try {
    if ("String_Node_Str".equals(props.getProperty("String_Node_Str" + zki.getName() + "String_Node_Str"))) {
      return zk.getChildren("String_Node_Str",false);
    }
 else {
      return zk.getChildren("String_Node_Str",false);
    }
  }
 catch (  KeeperException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return new ArrayList<String>();
}
Program: 82575
Project: 82575
Buggy source:
private ControllerCollector(InstanceManager manager,JdbcTemplate jdbc){
  this.zk=manager.getInstance();
  this.instanceId=manager.getInstanceId();
  this.jdbc=jdbc;
  updateControllers();
}

Fixed version (ground truth):
private ControllerCollector(InstanceManager manager,JdbcTemplate jdbc,Properties props,ZookeeperInstance zki){
  this.zk=manager.getInstance();
  this.instanceId=manager.getInstanceId();
  this.jdbc=jdbc;
  this.props=props;
  this.zki=zki;
  updateControllers();
}
Program: 82576
Project: 82576
Buggy source:
public static void collect(InstanceManager manager,JdbcTemplate jdbc){
  new ControllerCollector(manager,jdbc);
}

Fixed version (ground truth):
public static void collect(InstanceManager manager,JdbcTemplate jdbc,Properties props,ZookeeperInstance zki){
  new ControllerCollector(manager,jdbc,props,zki);
}
Program: 82583
Project: 82583
Buggy source:
private static FieldSelector getFieldSelector(final Selector selector){
  return new FieldSelector(){
    private static final long serialVersionUID=4089164344758433000L;
    @Override public FieldSelectorResult accept(    String fieldName){
      if (ROW_ID.equals(fieldName)) {
        return FieldSelectorResult.LOAD;
      }
      if (RECORD_ID.equals(fieldName)) {
        return FieldSelectorResult.LOAD;
      }
      if (PRIME_DOC.equals(fieldName)) {
        return FieldSelectorResult.NO_LOAD;
      }
      if (selector.columnFamiliesToFetch == null && selector.columnsToFetch == null) {
        return FieldSelectorResult.LOAD;
      }
      String columnFamily=getColumnFamily(fieldName);
      if (selector.columnFamiliesToFetch != null) {
        if (selector.columnFamiliesToFetch.contains(columnFamily)) {
          return FieldSelectorResult.LOAD;
        }
        return FieldSelectorResult.NO_LOAD;
      }
      String columnName=getColumnName(fieldName);
      if (selector.columnsToFetch != null) {
        Set<String> columns=selector.columnsToFetch.get(columnFamily);
        if (columns != null && columns.contains(columnName)) {
          return FieldSelectorResult.LOAD;
        }
      }
      return FieldSelectorResult.NO_LOAD;
    }
  }
;
}

Fixed version (ground truth):
private static FieldSelector getFieldSelector(final Selector selector){
  return new FieldSelector(){
    private static final long serialVersionUID=4089164344758433000L;
    @Override public FieldSelectorResult accept(    String fieldName){
      if (ROW_ID.equals(fieldName)) {
        return FieldSelectorResult.LOAD;
      }
      if (RECORD_ID.equals(fieldName)) {
        return FieldSelectorResult.LOAD;
      }
      if (PRIME_DOC.equals(fieldName)) {
        return FieldSelectorResult.NO_LOAD;
      }
      if (selector.columnFamiliesToFetch == null && selector.columnsToFetch == null) {
        return FieldSelectorResult.LOAD;
      }
      String columnFamily=getColumnFamily(fieldName);
      if (selector.columnFamiliesToFetch != null) {
        if (selector.columnFamiliesToFetch.contains(columnFamily)) {
          return FieldSelectorResult.LOAD;
        }
      }
      String columnName=getColumnName(fieldName);
      if (selector.columnsToFetch != null) {
        Set<String> columns=selector.columnsToFetch.get(columnFamily);
        if (columns != null && columns.contains(columnName)) {
          return FieldSelectorResult.LOAD;
        }
      }
      return FieldSelectorResult.NO_LOAD;
    }
  }
;
}
Program: 82584
Project: 82584
Buggy source:
@Override public FieldSelectorResult accept(String fieldName){
  if (ROW_ID.equals(fieldName)) {
    return FieldSelectorResult.LOAD;
  }
  if (RECORD_ID.equals(fieldName)) {
    return FieldSelectorResult.LOAD;
  }
  if (PRIME_DOC.equals(fieldName)) {
    return FieldSelectorResult.NO_LOAD;
  }
  if (selector.columnFamiliesToFetch == null && selector.columnsToFetch == null) {
    return FieldSelectorResult.LOAD;
  }
  String columnFamily=getColumnFamily(fieldName);
  if (selector.columnFamiliesToFetch != null) {
    if (selector.columnFamiliesToFetch.contains(columnFamily)) {
      return FieldSelectorResult.LOAD;
    }
    return FieldSelectorResult.NO_LOAD;
  }
  String columnName=getColumnName(fieldName);
  if (selector.columnsToFetch != null) {
    Set<String> columns=selector.columnsToFetch.get(columnFamily);
    if (columns != null && columns.contains(columnName)) {
      return FieldSelectorResult.LOAD;
    }
  }
  return FieldSelectorResult.NO_LOAD;
}

Fixed version (ground truth):
@Override public FieldSelectorResult accept(String fieldName){
  if (ROW_ID.equals(fieldName)) {
    return FieldSelectorResult.LOAD;
  }
  if (RECORD_ID.equals(fieldName)) {
    return FieldSelectorResult.LOAD;
  }
  if (PRIME_DOC.equals(fieldName)) {
    return FieldSelectorResult.NO_LOAD;
  }
  if (selector.columnFamiliesToFetch == null && selector.columnsToFetch == null) {
    return FieldSelectorResult.LOAD;
  }
  String columnFamily=getColumnFamily(fieldName);
  if (selector.columnFamiliesToFetch != null) {
    if (selector.columnFamiliesToFetch.contains(columnFamily)) {
      return FieldSelectorResult.LOAD;
    }
  }
  String columnName=getColumnName(fieldName);
  if (selector.columnsToFetch != null) {
    Set<String> columns=selector.columnsToFetch.get(columnFamily);
    if (columns != null && columns.contains(columnName)) {
      return FieldSelectorResult.LOAD;
    }
  }
  return FieldSelectorResult.NO_LOAD;
}
Program: 82585
Project: 82585
Buggy source:
@Override public void sync(String name) throws IOException {
  File file=_localFileCache.getLocalFile(_dirName,name);
  Path dest=new Path(hdfsDirPath,name + "String_Node_Str");
  Path source=new Path(file.getAbsolutePath());
  int count=0;
  while (true) {
    try {
      LOG.debug("String_Node_Str",file.getAbsolutePath(),hdfsDirPath);
      fileSystem.copyFromLocalFile(source,dest);
      rename(name + "String_Node_Str",name);
      return;
    }
 catch (    IOException e) {
      if (count < _retryCount) {
        count++;
        LOG.error("String_Node_Str",e,count,source,dest);
      }
 else {
        throw e;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void sync(String name) throws IOException {
  File file=_localFileCache.getLocalFile(_dirName,name);
  int count=0;
  while (true) {
    Path dest=new Path(hdfsDirPath,name + "String_Node_Str" + count);
    try {
      LOG.debug("String_Node_Str",file.getAbsolutePath(),hdfsDirPath);
      FSDataOutputStream outputStream=fileSystem.create(dest);
      InputStream inputStream=new BufferedInputStream(new FileInputStream(file));
      byte[] buffer=new byte[4096];
      int num;
      while ((num=inputStream.read(buffer)) != -1) {
        outputStream.write(buffer,0,num);
        _progressable.progress();
      }
      rename(name + "String_Node_Str" + count,name);
      return;
    }
 catch (    IOException e) {
      if (count < _retryCount) {
        LOG.error("String_Node_Str",e,count,file.getAbsolutePath(),dest);
        count++;
        try {
          fileSystem.delete(dest,false);
        }
 catch (        IOException ex) {
          LOG.error("String_Node_Str",ex,dest);
        }
      }
 else {
        throw e;
      }
    }
  }
}
Program: 82586
Project: 82586
Buggy source:
public IndexInput openFromLocal(String name,int bufferSize) throws IOException {
  if (Constants.WINDOWS) {
    return new FileIndexInput(_localFileCache.getLocalFile(_dirName,name),bufferSize);
  }
 else   if (name.endsWith("String_Node_Str")) {
    return new FileNIOIndexInput(_localFileCache.getLocalFile(_dirName,name),bufferSize);
  }
 else {
    return new MMapIndexInput(_localFileCache.getLocalFile(_dirName,name));
  }
}

Fixed version (ground truth):
public IndexInput openFromLocal(String name,int bufferSize) throws IOException {
  if (Constants.WINDOWS) {
    return new FileIndexInput(_localFileCache.getLocalFile(_dirName,name),bufferSize);
  }
 else   if (name.endsWith("String_Node_Str") || !Constants.JRE_IS_64BIT) {
    return new FileNIOIndexInput(_localFileCache.getLocalFile(_dirName,name),bufferSize);
  }
 else {
    return new MMapIndexInput(_localFileCache.getLocalFile(_dirName,name));
  }
}
Program: 82587
Project: 82587
Buggy source:
private File newFile(String dirName,String name){
  int index=random.nextInt(files.length);
  for (int i=0; i < files.length; i++) {
    File dir=new File(files[index],dirName);
    if (!dir.exists()) {
      dir.mkdirs();
    }
    try {
      File file=new File(dir,name);
      file.createNewFile();
      return file;
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",dir);
    }
    index++;
    if (index >= files.length) {
      index=0;
    }
  }
  fatalNoLocalDirs();
  return null;
}

Fixed version (ground truth):
private File newFile(String dirName,String name){
  int index=random.nextInt(files.length);
  for (int i=0; i < files.length; i++) {
    File dir=new File(files[index],dirName);
    if (!dir.exists()) {
      dir.mkdirs();
    }
    try {
      createDir(dir);
      File file=new File(dir,name);
      return file;
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",dir);
    }
    index++;
    if (index >= files.length) {
      index=0;
    }
  }
  fatalNoLocalDirs();
  return null;
}
Program: 82588
Project: 82588
Buggy source:
public void init(){
  super.init();
  startIndexReaderCloserDaemon();
  startIndexReopenerDaemon();
}

Fixed version (ground truth):
public void init(){
  super.init();
  startIndexReaderCloserDaemon();
}