nus-yam/ex-repair huggingface dataset:
Program: 1453
Project: 1453
Buggy source:
private void waitForTheTableToEnable(String cluster,String table) throws BlurException {
  LOG.info("String_Node_Str" + table + "String_Node_Str");
  while (true) {
    if (_clusterStatus.isEnabled(true,cluster,table)) {
      return;
    }
    try {
      Thread.sleep(3000);
    }
 catch (    InterruptedException 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):
private void waitForTheTableToEnable(String cluster,String table) throws BlurException {
  LOG.info("String_Node_Str" + table + "String_Node_Str");
  while (true) {
    if (_clusterStatus.isEnabled(false,cluster,table)) {
      return;
    }
    try {
      Thread.sleep(3000);
    }
 catch (    InterruptedException e) {
      LOG.error("String_Node_Str" + table + "String_Node_Str",e);
      throw new BException("String_Node_Str" + table + "String_Node_Str",e);
    }
  }
}
Program: 1454
Project: 1454
Buggy source:
public static void disableTable(ZooKeeper zookeeper,String cluster,String table) throws IOException, InterruptedException, KeeperException {
  if (zookeeper.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  if (zookeeper.exists(blurTableEnabledPath,false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  zookeeper.delete(blurTableEnabledPath,-1);
  waitForWriteLocksToClear(zookeeper,cluster,table);
}

Fixed version (ground truth):
public static void disableTable(ZooKeeper zookeeper,String cluster,String table) throws IOException, InterruptedException, KeeperException {
  if (zookeeper.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  if (zookeeper.exists(blurTableEnabledPath,false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  zookeeper.delete(blurTableEnabledPath,-1);
}
Program: 1455
Project: 1455
Buggy source:
public static void enableTable(ZooKeeper zookeeper,String cluster,String table) throws IOException, KeeperException, InterruptedException {
  if (zookeeper.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  if (zookeeper.exists(blurTableEnabledPath,false) != null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  zookeeper.create(blurTableEnabledPath,null,Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
  int shardCount=getShardCount(zookeeper,cluster,table);
  waitForWriteLocksToEngage(zookeeper,cluster,table,shardCount);
}

Fixed version (ground truth):
public static void enableTable(ZooKeeper zookeeper,String cluster,String table) throws IOException, KeeperException, InterruptedException {
  if (zookeeper.exists(ZookeeperPathConstants.getTablePath(cluster,table),false) == null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  String blurTableEnabledPath=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  if (zookeeper.exists(blurTableEnabledPath,false) != null) {
    throw new IOException("String_Node_Str" + table + "String_Node_Str");
  }
  zookeeper.create(blurTableEnabledPath,null,Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
}
Program: 1456
Project: 1456
Buggy source:
@Override public final void enableTable(String table) throws BlurException, TException {
  try {
    String cluster=_clusterStatus.getCluster(false,table);
    if (cluster == null) {
      throw new BlurException("String_Node_Str" + table + "String_Node_Str",null);
    }
    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);
    if (cluster == null) {
      throw new BlurException("String_Node_Str" + table + "String_Node_Str",null);
    }
    EnableTable.enableTable(_zookeeper,cluster,table);
    waitForTheTableToEnable(cluster,table);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e,table);
    throw new BException(e.getMessage(),e);
  }
}
Program: 1458
Project: 1458
Buggy source:
public void deleteDocuments(boolean wal,Term term) throws CorruptIndexException, IOException {
  _dirty.incrementAndGet();
  deleteDocuments(wal,term);
}

Fixed version (ground truth):
public void deleteDocuments(boolean wal,Term... terms) throws CorruptIndexException, IOException {
  _dirty.incrementAndGet();
  if (wal) {
    Future<Boolean> valid=walWriterDelete(terms);
    super.deleteDocuments(terms);
    try {
      if (!valid.get()) {
        throw new IOException("String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
      throw new IOException(e);
    }
catch (    ExecutionException e) {
      throw new IOException(e);
    }
  }
 else {
    super.deleteDocuments(terms);
  }
}
Program: 1459
Project: 1459
Buggy source:
@Override public void action(WalIndexWriter indexWriter) throws CorruptIndexException, IOException {
  Collection<Document> docs=getDocs();
  indexWriter.updateDocuments(false,new Term("String_Node_Str","String_Node_Str"),docs);
}

Fixed version (ground truth):
@Override public void action(WalIndexWriter indexWriter) throws CorruptIndexException, IOException {
  indexWriter.deleteDocuments(true,new Term("String_Node_Str","String_Node_Str"));
}
Program: 1460
Project: 1460
Buggy source:
public SuperParser(Version matchVersion,Analyzer a,boolean superSearch,Filter queryFilter,ScoreType scoreType){
  super(matchVersion,SUPER,a);
  this.setAllowLeadingWildcard(true);
  this.superSearch=superSearch;
  this.queryFilter=queryFilter;
  this.scoreType=scoreType;
}

Fixed version (ground truth):
public SuperParser(Version matchVersion,Analyzer a,boolean superSearch,Filter queryFilter,ScoreType scoreType){
  super(matchVersion,SUPER,a);
  this.setAutoGeneratePhraseQueries(true);
  this.setAllowLeadingWildcard(true);
  this.superSearch=superSearch;
  this.queryFilter=queryFilter;
  this.scoreType=scoreType;
}
Program: 1462
Project: 1462
Buggy source:
@Override public String getCluster(boolean useCache,String table){
  if (useCache) {
    Map<String,List<String>> map=_tableToClusterCache.get();
    List<String> clusters=map.get(table);
    if (clusters == null || clusters.size() == 0) {
      return null;
    }
 else     if (clusters.size() == 1) {
      return clusters.get(0);
    }
 else {
      throw new RuntimeException("String_Node_Str" + table + "String_Node_Str"+ clusters+ "String_Node_Str");
    }
  }
  List<String> clusterList=getClusterList();
  for (  String cluster : clusterList) {
    try {
      Stat stat=_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false);
      if (stat != null) {
        return cluster;
      }
    }
 catch (    KeeperException e) {
      throw new RuntimeException(e);
    }
catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String getCluster(boolean useCache,String table){
  if (useCache) {
    Map<String,List<String>> map=_tableToClusterCache.get();
    List<String> clusters=map.get(table);
    if (clusters == null || clusters.size() == 0) {
      throw new RuntimeException("String_Node_Str" + table + "String_Node_Str");
    }
 else     if (clusters.size() == 1) {
      return clusters.get(0);
    }
 else {
      throw new RuntimeException("String_Node_Str" + table + "String_Node_Str"+ clusters+ "String_Node_Str");
    }
  }
  List<String> clusterList=getClusterList();
  for (  String cluster : clusterList) {
    try {
      Stat stat=_zk.exists(ZookeeperPathConstants.getTablePath(cluster,table),false);
      if (stat != null) {
        return cluster;
      }
    }
 catch (    KeeperException e) {
      throw new RuntimeException(e);
    }
catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
  throw new RuntimeException("String_Node_Str" + table + "String_Node_Str");
}
Program: 1463
Project: 1463
Buggy source:
@Override public void run(){
  clearMapOfOldTables(_tableAnalyzers);
  clearMapOfOldTables(_tableDescriptors);
  clearMapOfOldTables(_layoutManagers);
  clearMapOfOldTables(_layoutCache);
  clearMapOfOldTables(_tableSimilarity);
  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);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    cleanup();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 1464
Project: 1464
Buggy source:
private void removeAnyTableLocks(){
  List<String> tableList=_clusterStatus.getTableList();
  for (  String table : tableList) {
    _clusterStatus.clearLocks(cluster,table);
  }
}

Fixed version (ground truth):
private void removeAnyTableLocks(){
  List<String> tableList=_clusterStatus.getTableList(cluster);
  for (  String table : tableList) {
    _clusterStatus.clearLocks(cluster,table);
  }
}
Program: 1467
Project: 1467
Buggy source:
public void init(){
  _timer=new Timer("String_Node_Str",true);
  _timer.schedule(new TimerTask(){
    @Override public void run(){
      sampleAll();
    }
  }
,_delay,_period);
}

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

Fixed version (ground truth):
@Override public void run(){
  try {
    sampleAll();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 1469
Project: 1469
Buggy source:
public void init(){
  statusCleanupTimer=new Timer("String_Node_Str",true);
  statusCleanupTimer.schedule(new TimerTask(){
    @Override public void run(){
      try {
        cleanupFinishedQueryStatuses();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
,statusCleanupTimerDelay,statusCleanupTimerDelay);
}

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

Fixed version (ground truth):
@Override public void run(){
  try {
    cleanupFinishedQueryStatuses();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 1471
Project: 1471
Buggy source:
@Override public void run(){
  for (  BlurIndex index : _indexes) {
    try {
      index.refresh();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e,index);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    refreshInternal();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 1472
Project: 1472
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: 1473
Project: 1473
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: 1474
Project: 1474
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: 1475
Project: 1475
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: 1476
Project: 1476
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: 1477
Project: 1477
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: 1478
Project: 1478
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: 1479
Project: 1479
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: 1480
Project: 1480
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: 1481
Project: 1481
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: 1482
Project: 1482
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: 1483
Project: 1483
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: 1484
Project: 1484
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: 1485
Project: 1485
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: 1486
Project: 1486
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: 1487
Project: 1487
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: 1488
Project: 1488
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: 1489
Project: 1489
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: 1490
Project: 1490
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: 1491
Project: 1491
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: 1492
Project: 1492
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: 1493
Project: 1493
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: 1494
Project: 1494
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: 1495
Project: 1495
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: 1496
Project: 1496
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: 1497
Project: 1497
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: 1498
Project: 1498
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: 1499
Project: 1499
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: 1501
Project: 1501
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();
    }
  }
}